[pmwiki-users] Help with a script

J. Meijer commentgg at hotmail.com
Thu Jan 11 21:45:54 CST 2007


It's late. The following is a bit more complete answer:



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(array('{$value}','$SCItem'),array($value,$SCItem),$SearchCloudListFmt);
 
That should resolve your problem. 
 
Vizinho,

 /jm



 ps  your loop doesn't seem to make much sense. Don't you want to test on (value != 0)? Like this:
 
foreach ($SearchCloud as $SCItem => $value) 
   if($value) 
        $output .= str_replace(array('{$value}','$SCItem'),array($value,$SCItem),$SearchCloudListFmt);





> 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);
> 
>  
> 

_________________________________________________________________
Try amazing new 3D maps
http://maps.live.com/?wip=51



More information about the pmwiki-users mailing list