Hello all, first post woo!
I have an html page loaded into a PHP variable and am using str_replace to change certain words with other words. The only problem is that if one of these words appears in an important peice of code then the whole thing falls to bits.
Is there any way to only apply the str_replace function to certain html tag...
<img src = "<?= $link ?>"></img>
Short tags is enabled in php.ini and in config.php of codeigniter.
Also tried
<img src = "<?php echo $link; ?>"></img>
but doesn't work. In the HTML output its just "", although a simple <?php echo $link; ?> does work.
...
I am new to using simpletest: http://www.simpletest.org/ for PHP and am using PHP 5.2* on my server, when I try to set up an initial test script based on their demo, I get a page full of errors like the one below... I am not sure if this is something to do with simpletest not being compatible with PHP 5.* or what the issue is, any insigh...
How do I convert the standard php timestamp e.g. 1278184362 into this format
2010-07-03 19:00:00 ?
needs to be exact...
Any ideas guys?
...
I have this PHP code -
<?php
for($i=1; $i<=1000; $i++) {
$array=array();
$array[$i]=54*$i;
$arr=array($array[$i].",");
foreach ($arr as $value) {
echo $value;
}
}
?>
I tried with:
var i;
for(i=1;i<=1000;i++) {
var array = new Array();
array[i] = 54*i;
var arr = new Array();
arr.push(array[i]+",");
}
alert(ar...
I'm writing a simple file-caching engine in PHP that needs to be able to see how big a directory is. What I'm looking for is the equivalent of Unix's du command to simply print the total filesize of a directory. I can write it myself, but if somebody else already figured out all the issues of recursing and handling symlinks and so on, ...
What is the best way of replacing a set of short tags in a PHP string, example:
$return = "Hello %name%, thank you for your interest in the %product_name%. %representative_name% will contact you shortly!";
Where I would define that %name% is a certain string, from an array or an object such as:
$object->name;
$object->product_name;
...
I have a guestbook, and I want to convert site address in the following [link]www.yahoo.com[/link] to <a>...
So how is it do that str_replace?
...
I am trying to build a system of monitoring site / server uptime in PHP, the system will be required to check thousands of domains / ips a minute. I have looked into cURL as this seems to be the best method.
Edit:
The system will be required to probe a server, check its response time is reasonable, and return its response code. It will...
Where I'm stuck is the right parameter syntax to instantiate an object using PHP's com() and dotnet() classes to load .net assemblies, windows system applications and components beyond the usual MS Office apps. If successfully created, working with the objects isn't an issue here.
Can anyone explain what each part of each parameter mea...
Hello, i have this 3 tables
forums_forum
+-----+--------+-------------+-------+-----+
| fid | name | description | index | cid |
+-----+--------+-------------+-------+-----+
| 36 | gdghdf | hjghj | 54 | 5 |
| 45 | yutuy | iuyi | 99 | 6 |
+-----+--------+-------------+-------+-----+
forums_threads
+----+--...
I'm working on some theme options that require cropping an image to the user's specification. I've got the JS interface for image cropping down, but I'm wondering if WordPress has any built in functionality I can tap into to crop and re-save the image using the provided dimensions.
Thank you for any pointers!
...
I have written a WordPress plugin, and I am trying to find the best way of having the program check for updates on my server, and downloading them automatically at the user's request. This will basically be used to download extra features that I don't want to put into the WordPress repository due them not having the GNU license.
I've ...
I'm trying to replace the ~ into | between the [ ] in the folowwing case:
{stackoverflow is a [cool~great~fast] website ~ Find your answers [easily~quickly] on stackoverflow}.
Note: The text between the [ ] can be multiline.
I've tried multiple regexs buth with no luck.
My closest call at the moment is:
$text = preg_replace("/\[(.*...
Is there a way to set an IF statement in MySQL or PHP to write something to a column or not? What I want to do is completely skip a column so that "NULL" is written to it, in case there is no data to be submitted in the column.
In case nothing is to be submitted to the database in one column, I want it to be NULL for that record obvious...
I am developing a project that lately have been taking off with increased popularity.
This development is of course met with open arms and has also been somewhat expected. I have therefore taken every precaution I could about creating efficient and secure code. However, when it comes to server capacity I haven't had the financial means ...
Hi,
I am trying to make a cache class that makes url into a static file. When I click 'Cache' button on the backend, it might cause users to see error on their browsers since files do not support lock. Am I correct???
...
I don't know what the deal is here…
So I want to run an applescript: sudo osascript myscript.scpt
it works fine in the terminal, however when I execute it via PHP's exec(), nothing happens.
The console says no tty present and no askpass program specified ; TTY=unknown ; …
I did my research, and it seems I'm missing the password for th...
Hello,
I'd like to change certain color in an image on a webpage based on user selected color, it this possible using php or javascript.
if it not possible or will be difficult, how do i do it using flash?
please help me with sample code or website.
thanks
...
Hi,
recently, I have been working on a small project for a client. I was thinking about using a wordpress style pretty URL format. I googled around a lot and came accross Apache’s mod_rewrite and RewriteRule, RewriteCond. But didn't find any example which can handle random of parameters. For example:
/index.php?param=1 → /index/param/...