[pmwiki-users] Help with a script

J. Meijer commentgg at hotmail.com
Thu Jan 11 19:59:08 CST 2007



On 1/11/07,  Carlos A. Bonamigo <carlos.ab at gmail.com> wrote:
I'm having troube with a script I hope someone can give me a hint on this one.

I'm trying to use this inside a script:

SDV($SearchCloudListFmt ,'
%font-size={$value}px%[[$ScriptUrl?action=search&q=$SCItem | $SCItem ]]
');

and using a foreach like this:

foreach ($SearchCloud as $SCItem=>$value){
   if($SearchCloud != "" && $SCItem != "0")
        $output .= $SearchCloudListFmt;
}

to fill variables inside $SearchCloudFmt , but no success so far.

What I'm missing here... Besides learning the basics. :c)

CarlosAB



Automatic variable substitution occurs in PHP inside strings within ".." (double quotes). Once the string exists, no automatic substitutions take place. 

You apparently are trying to have {$value} replaced in $SearchCloudListFmt. Well try doing just that:

        $output .= str_replace('{$value}',$value,$SearchCloudListFmt);

That should resolve your problem. 

Vizinho,

/jm





ps  your loop doesn't seem to make any sense. Don't you want to test on (value != 0), like this:

foreach ($SearchCloud as $value) 
   if($value) 
        $output .= str_replace('{$value}',$value,$SearchCloudListFmt);

 

_________________________________________________________________
Type your favorite song.  Get a customized station.  Try MSN Radio powered by Pandora.
http://radio.msn.com



More information about the pmwiki-users mailing list