...

View Full Version : Variables in echo statement with array.



chefben
09-22-2009, 09:45 AM
I'm trying the following PHP in a wordpress page template and not having too much luck. Ideally it should output a H2 with Twitter + the page title and then the 10 last posts on twitter related to the page title. I am guessing cause its an echo.



<h2><a rel="nofollow" href="http://www.twitter.com">Twitter <?php the_title(); ?> </a></h2>
<ul>
<?php
echo SimplePieWP('http://search.twitter.com/search.atom?q=<?php the_title(); ?>
', array(
'items' => 10,
));
?>
</ul>



Anyone ?

Phil Jackson
09-22-2009, 10:00 AM
id have to see the functions but this should help


<?php echo SimplePieWP("http://search.twitter.com/search.atom?q=".the_title(), array("items" => 10)); ?>

chefben
09-22-2009, 10:53 AM
Phil,

I dropped that in and it didnt work.

What functions do you need to see ?

Whats good to debug ? or see errors ?

Benjamin

chefben
09-22-2009, 10:57 AM
All it is outputting now is the title. Any other syntax ?

Benjamin

Phil Jackson
09-22-2009, 11:31 AM
i need to know what this function does: SimplePieWP(); and the_title();

chefben
09-22-2009, 12:16 PM
Its a Wordpress site.

So, the_title(); pulls the Page Title &

SimplePieWP(); see;

http://simplepie.org/wiki/plugins/wordpress/simplepie_plugin_for_wordpress?rev=1182456212

Is that what you need ?

Phil Jackson
09-22-2009, 12:22 PM
see i dont use word press.
I need to know what this function does to know how to help you.



SimplePieWP($addressOrSomeSort, $andThisIsSomething);


Do you understand what i mean?

Phil Jackson
09-22-2009, 12:25 PM
<?php
echo SimplePieWP("http://search.twitter.com/search.atom?q=".the_title(), array('items' : 10));
?>



should limit the number of posts returned to 10.

chefben
09-22-2009, 12:27 PM
yeah on the link under parameters about half way down.

http://simplepie.org/wiki/plugins/wordpress/simplepie_plugin_for_wordpress?rev=1182456212

chefben
09-22-2009, 12:30 PM
ok I got it displaying now using, this..... but its not right. its now searching .the_title() instead of the name of the page.


<?php echo SimplePieWP('http://search.twitter.com/search.atom?q=.the_title()', array("items" => 10)); ?>

chefben
09-22-2009, 12:47 PM
just tried another RSS feed and it too is displaying feeds with "title" in them

Phil Jackson
09-22-2009, 01:39 PM
try (copy and paste)


<?php
$title = the_title();
echo SimplePieWP("http://search.twitter.com/search.atom?q=$title",
array('items' : 10));
?>

chefben
09-22-2009, 02:17 PM
i actually just worked it out in the end. thanks for all your help Phil.



<?php echo SimplePieWP (array(
'http://search.twitter.com/search.atom?q=' . urlencode ( the_title ( '' , '' , false ) ) . ''
),array( 'items' => '6' )); ?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum