Some php help over here please....

glew

Junior Member
Joined
Feb 10, 2008
Messages
141
Reaction score
95
can someone show me the correct way to turn this into a variable!


Code:
<?php $posttags = get_the_tags(); 

$count=0; if ($posttags) 

{ foreach($posttags as $tag) 

{ $count++; if (1 == $count) 

{ echo $tag->name . ' '; } } } ?>

this was my last attempt but more errors :(

Code:
$box = '<?php' . $posttags . '= get_the_tags();

' . $count . '=0; if (' . $posttags . ') 

{ foreach(' . $posttags . 'as ' . $tag) 

{ $count++; if (1 == $count) 

{ echo $tag->name . '"\' \'; } } } ?>'

i just can't figure out what to and what not to escape anytime I have a complex
expression ie:
Code:
$box = <?php bloginfo(template_url) . /images/blank.jpg; ?>

it's pissing me off! :banghead: any help would be appreciated!
 
Hmmm, can you tell us a little more about where the code has come from;
get_the_tags() and bloginfo() are both custom functions, I assume associated with WP or someother OS software.

aReJay
 
Why do you need this stored as a variable?

Another solution, if I'm on the right path here, is to just store this code into a separate PHP by it self and then just add "include( "path/phpfile.php" );" ( minus the outside "" ) where ever you need that code to execute.

_Austin
 
Back
Top