solrman Posted May 16, 2009 Share Posted May 16, 2009 I am trying to get the following (what should be a simple code) to work. What the code is supposed to do is rotate html files within the page to keep different content rotating 1st part is the php file i am trying to run, 2nd part is the "Include" code I insert on the page I want to run it; Can someone diagnose where I am going wrong with this? I keep getting unexpected ")" on line 10 of rand_article.php Here are the codes I am using - any assistance would be much appreciated. //random_article.php// 1 <?php 2 function randomarticle () { 3 $article = array( 4 'articles/article001.html', 5 'articles/article002.html', 6 'articles/article003.html', 7 'articles/article004.html'); 8 9 $random = rand(0, count($article) - 1); 10 return($article[$random]); 11 } 12 ?> code I insert onto the .php page <? include_once("random_article.php"); ?> I know I am close but I cannot figure out what i am not doing correctly. Thanks again for any assistance. Link to comment https://forums.phpfreaks.com/topic/158351-php-content-rotator-question/ Share on other sites More sharing options...
Michdd Posted May 16, 2009 Share Posted May 16, 2009 You'd what to do something like: <?php include_once('random_article.php'); include_once(randomarticle()); //Get the random article to include ?> Link to comment https://forums.phpfreaks.com/topic/158351-php-content-rotator-question/#findComment-835130 Share on other sites More sharing options...
solrman Posted May 16, 2009 Author Share Posted May 16, 2009 That Sure did the trick! Thank you so much...you're Brilliant! solrman Link to comment https://forums.phpfreaks.com/topic/158351-php-content-rotator-question/#findComment-835132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.