Shazbot! Posted December 1, 2006 Share Posted December 1, 2006 I am trying to create tabs, but I am still new to php. I am using php 5 on a win server with IIS.I am using the tab script found in PHP Hacks book by Jack Herrington (hack#6)however, I am getting an error message that I cannot figure out.[quote]PHP Notice: Use of undefined constant title - assumed 'title' in E:\XXXX\Link\wwwroot\test_tabX3.php on line 71 PHP Notice: Use of undefined constant text - assumed 'text' in E:\XXXX\Link\wwwroot\test_tabX3.php on line 71 PHP Notice: Use of undefined constant title - assumed 'title' in E:\XXXX\Link\wwwroot\test_tabX3.php on line 71 PHP Notice: Use of undefined constant text - assumed 'text' in E:\XXXX\Link\wwwroot\test_tabX3.php on line 71 [/quote]This is where the error is occuring:[code]function tab($title){ global $tabs; echo "$title<br /><br />"; if (count($tabs)>0) { endtab(); }//end if $tabs[] = array(title=>$title,text=>""); //<--------Line 71 } //end function[/code]This is where it is calling from:[code]function tabs_end(){global $tabs;endtab();ob_end_clean();$index = 0;if($_GET['tabindex']) { $index=$_GET['tabindex']; }?><table width="100%" cellspacing="0" cellpadding="0"><tr> <?php $baseuri = $_SERVER['PHP_SELF']; $baseuri = preg_replace("/\?.*$/","",$baseuri); $curindex=0; foreach ($tabs as $tab) { $class= "tab"; if ($index==$curindex) { $class = "tab-active"; } //end if ?> <td class="<?php echo($class); ?>"> <a href="<?php echo($baseuri."?tabindex=".$curindex); ?>"><?php echo($tab['title']); ?></a> </td> <?php $curindex +=1; } //end foreach ?> </tr> <tr> <td class="tab-content" colspan="<?php echo(count($tabs)+1);?>"> </td> </tr> </table><?php} //end function?>[/code]I have been looking at this code for about 2 days now and have re-written it but keep getting different errors. This is the closest I have to a solution. I am hoping someone out there would kindly look at it and perhaps see something I haven't. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/29147-trying-to-create-creating-tabs/ Share on other sites More sharing options...
Caesar Posted December 1, 2006 Share Posted December 1, 2006 That's a notice and not an error. You can either define the variable beforehand, or you can change the value of "error_reporting" in your php.ini file on the server to "E_ALL & ~E_NOTICE & ~E_STRICT". The error reporting level is set too low. Link to comment https://forums.phpfreaks.com/topic/29147-trying-to-create-creating-tabs/#findComment-133635 Share on other sites More sharing options...
Shazbot! Posted December 1, 2006 Author Share Posted December 1, 2006 Thanks for the input Caesar, however I do not have access to the php.ini file. I am not the admin of the server.I did place [i]error_reporting(0)[/i] at the top and the message does go away but it doesn't display the information that is supposed to be tab array. I will keep playing with it but if you have any advice I will be glad to try them out.Thanks! Link to comment https://forums.phpfreaks.com/topic/29147-trying-to-create-creating-tabs/#findComment-133677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.