Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

Showing everything..

Quote Reply
Showing everything..
I've jsut written some code to print out all the variables in the $GLOBALS array..and then I was trying to print out everything in $links_loop. For some reason, this code isn't working correctly;

Code:
<? foreach ($GLOBALS as $item => $var) { echo "&nbsp;&nbsp;$item => $var<BR>"; }

echo "now array..";

foreach ($links_loop as $thing) {

foreach ($links_loop['$thing'] as $loop => $val) { echo "&nbsp;&nbsp;$loo => $val"; }

}

?>

For some reason, the last foreach is brining up an error. How would I refer to the sub-arrays within $globals?

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Showing everything.. In reply to
Never mind...I worked it out Smile

Code:
<? foreach ($GLOBALS as $item => $var) { echo "&nbsp;$item => $var<BR>"; } ?>

<? echo "now array.."; ?>
<?

$i = 0;
foreach ($links_loop as $thing => $val) {

$i++;
echo "<BR>";
foreach ($links_loop[$thing] as $line => $val) { echo "&nbsp;&nbsp;&nbsp;&nbsp;$line => $val<BR>"; }

}

?>

That prints out everything in the $GLOBALS variable..and all the link variables that are available. May come in handy for people like me, who are working on PHP Plugins Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Showing everything.. In reply to
I don't see where you even use $i ?
Quote Reply
Re: [Andy] Showing everything.. In reply to
Why do that when you can just do:
Code:
<pre><?print_r($GLOBALS)?></pre>
or
Code:
<pre><?print_r(get_defined_vars())?></pre>
for all available variables.

Adrian
Quote Reply
Re: [Paul] Showing everything.. In reply to
Because in the plugin I was working on, I use;

$i++;
some other stuff here { $add[$i]; }

to populate the add array for use later.

I'm just trying to port over my Count_Impressions plugin to PHP...and it seems to be going quite well :)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!