need help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
teksys
Forum Commoner
Posts: 34
Joined: Tue May 14, 2002 6:58 pm
Location: Denmark

need help!

Post by teksys »

Hello, i would like some PHP-HTML-guru-PRO to help me with the code i am about to post. It's nothing fancy or advanced in anyway. I use the following code in a theme i made for a project i have been working on for some time now....but..the HTML is rather messed up, so is probably some of the code, too. If anyone would be kind to help me out with some better html, i would be glad..like, when i want to add another theme_blah(); function (table with links or text, for example.) - the whole site gets messed up, and i think it has to do with the HTML..please overlook this someone...thanks!

Code: Select all

<?php

/* devish v0.1 configuration file.
   developer: micke andersson
   email: root@g33k.net
   webpage: http://teksys.joshie.com/
*/

function theme_Index() &#123;
global $PHP_ext,$index_file,$main_file,$login_file,$logout_file,$options_file,$function;
global $preferances_file,$uid,$upass,$name,$site_name,$tbl_color1,$tbl_color2;
?>
<!-- theme_Index(); starts here -->
 </head>

<body bgcolor="#ffffff">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top" align="center">
</td>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="5">
 <tr>
  <td valign="top" width="155"><table width="155" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
   <tr>
    <td width="155"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr bgcolor="<? print $tbl_color1 ?>">
      <td><b><p align="center"><font color="#ffffff">navigation</font></b></td>
   </tr>
 <tr bgcolor="#ffffff">
  <td><table width="100%" border="0" cellspacing="0" cellpadding="5">
   <tr>
    <td>
    <font color="#000000">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr><td>
</table>
<!-- NavigationLinks(); starts here -->
    <?php NavigationLinks(); ?>
<!-- NavigationLinks(); ends here -->
</font>    </td>
   </tr>
  </table></td>
 </tr>
<?php
&#125;

function theme_Nav() &#123;
global $PHP_ext,$index_file,$main_file,$login_file,$logout_file,$options_file,$function;
global $preferances_file,$uid,$upass,$name,$site_name, $tbl_color1, $tbl_color2;
?>
<!-- theme_Nav(); starts here -->
 <tr>
  <td width="155"><table width="155" border="0" cellspacing="0" cellpadding="0">
   <tr bgcolor="<? print $tbl_color1 ?>">
    <td><b><p align="center"><font color="#ffffff"><? echo "user: " . user($uid, $upass, "name") . ""; ?></font></b></td>
   </tr>
  <tr bgcolor="#ffffff">
   <td><table width="100%" border="0" cellspacing="0" cellpadding="5">
    <tr><td><font color="#000000">
    <!-- UserLinks(); starts here -->
    <? UserLinks(); ?>
    <!-- UserLinks(); ends here -->
   </font></td></tr></table></td></tr></table>
  </td>
 </tr>
</table>
  </td>
 </tr>
</table>
 </td>
<?php
&#125;

function theme_Usersonline() &#123;
global $uid,$upass,$name,$tbl_MiscSettings;
?>
<!-- useronline(); starts here -->
<td valign="top" width="100%">
<font color="#000000">
<dev align="left"><? if ($tbl_MiscSettings&#1111;random_welcome] == "yes") &#123; random_welcome(); &#125; ?></div><div align="right"><b><? if ($tbl_MiscSettings&#1111;usersonline] == "yes") &#123; usersonline(); &#125; ?></b>
</b></div></font><br>
<center><img src="<? print $root_path; ?>/misc/images/pixel_black.gif" width="100%" height="1"></center>
<?php
&#125;

function theme_News() &#123;
global $tbl_MiscSettings;
?>
<!-- theme_News(); starts here -->
<table width="100%" border="0" cellspacing="8" cellpadding="0">
<tr valign="top">
<td valign="top" width="70%"><font color="#000000">
<!-- randomslogan(); starts here -->
<b><?php if ($tbl_MiscSettings&#1111;random_slogan] == "yes") &#123; randomslogan(); br(); br(); &#125; ?></b>
<!-- randomslogan(); ends here -->
<?php include('C:\www\Apache\htdocs\bin\devnews\news.php'); ?>
</font></td>
<?php
&#125;

function theme_InternalNews() &#123;
global $result,$total_news,$tables, $tbl_color1, $tbl_color2;
?>
<!-- theme_InternalNews(); starts here -->
<td>
<td valign="top">
  <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
   <tr>
    <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr bgcolor="<? print $tbl_color1 ?>">
    <td><b><p align="center"><font color="#ffffff">internal news</font></b></td>
   </tr>
  <tr bgcolor="#ffffff">
   <td><table width="100%" border="0" cellspacing="0" cellpadding="5">
    <tr><td><font color="#000000">
    <p><b><font ize="1"></b><? print "there are '<b>$total_news</b>' news posts in our table '<b>$tables&#1111;news]</b>'.<br>";
    //br();
    //br();
    if(file_exists($root_path.'news.txt'))
	include($root_path.'news.txt');
    //include('C:\www\Apache\htdocs\news.txt');
    br(); ?><br></font></p>
  </font></td></tr></table></td></tr></table></td></tr></table>
  </td>
 </tr>
</table>
<?php
&#125;

function theme_Footer() &#123;
global $tbl_color1, $tbl_color2;
?>
<!-- theme_Footer(); starts here -->
 <tr>
<table border="0" width="75%" cellspacing="0" cellpadding="1" tr align="center" valign="bottom" bgcolor="<? print $tbl_color1 ?>">
  <td width="75%" align="center"><p align="center"><b><font color="#ffffff">
  <table border="0" width="75%" cellspacing="0" cellpadding="0">
   <tr>
    <td align="center"><font color="#ffffff"><?php
footer(); ?></font></b></td>
   </tr>
  </table>
  </font></td>
 </tr>
</tr>
 </table>

</body>
</html>
<?php
&#125;

function Codems_Index() &#123;
global $tbl_color1, $tbl_color2;
?>
 </head>

<body bgcolor="#ffffff">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top" align="center">
<font face="Verdana" size="1"></font></td>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="5">
 <tr>
  <td valign="top" width="155"><table width="155" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
   <tr>
    <td width="155"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr bgcolor="<? print $tbl_color1 ?>">
      <td><b><p align="center"><font face="Verdana" size="1" color="#ffffff">tekcodesys stats</font></b></td>
   </tr>
 <tr bgcolor="#ffffff">
  <td><table width="100%" border="0" cellspacing="0" cellpadding="5">
   <tr>
    <td>
    <font face="verdana" size="1">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr><td>
</table>
<!-- stats starts here -->
<?php
// total comments.
tek_connect(localhost, root, whereisthelegend, codems); // connect to the codems database.
     $result = mysql_query("select * from phpcodems_comments");
     $total = mysql_num_rows($result);
     echo "Total Comments: <b>$total</b><br>";
// end total comments.

echo 'Total Codes: <b>'.get_amount_submissions().'</b><br>';

// total categories
     $result = mysql_query("select * from phpcodems_categories");
     $total = mysql_num_rows($result);
     echo "Total Categories: <b>$total</b><br>";
// end total categories.

// total users
     $result = mysql_query("select * from phpcodems_users");
     $total = mysql_num_rows($result);
     echo "Total Users: <b>$total</b><br>";
// end total users

 ?>
<!-- stats ends here -->
</font>    </td>
   </tr>
  </table></td>
 </tr>
<?php
&#125;

?>
Tiimmy
Forum Commoner
Posts: 38
Joined: Sat Apr 27, 2002 1:56 am
Location: Australia
Contact:

Post by Tiimmy »

As it is, that's just too much code for me to read clearly without syntax highlighting. All I recommend at the moment, is that you test your script with stricter error reporting, like so:

Code: Select all

&lt;?php
error_reporting(E_ALL);
?&gt;
Simply add that to the top of your script and await the results. That should make it easier to pinpoint your errors. :wink:
User avatar
teksys
Forum Commoner
Posts: 34
Joined: Tue May 14, 2002 6:58 pm
Location: Denmark

mmm

Post by teksys »

well, thanks. but the PHP code in the post i posted is not a big problem, it's just that the PHP code is sloppy (IE, working.) - it's the messed up HTML...

this is how a basic script.php file can look when i use my 'theme-engine'

Code: Select all

<?php
require 'theme_configuration.inc'; //blah
require 'theme.inc'; //blah

theme_Index(); // generate the index.
theme_Nav(); // generate navigation.
theme_Usersonline(); // generate useronline information/stats.

print "THIS IS WHERE ANY CODE OR TEXT WOULD GO. BUT theme_InternalNews(); GETS MESSED UP THEN. HTML PROBLEM, PROBABLY!";

theme_InternalNews(); // generate Internalnews, our simple inbuilt news system.
theme_Footer(); // generate footer information.
?>
Thats how a basic file could look, where "print" is, that is where i put content and use functions - etc. but if i want to add another theme_blah(); function to the theme_configuration.inc (see other posted code.) and add a table to it and stuff, it all gets messed up..looks very awkward, i cant even use it when it is like that.....

that is why i would like someone good at PHP/HTML to see if they can make the other code i posted, to look better and see if i got problems in the HTML - I must admit that i am NOT good at html :)
User avatar
teksys
Forum Commoner
Posts: 34
Joined: Tue May 14, 2002 6:58 pm
Location: Denmark

bump

Post by teksys »

bumping this post, as i really need some help with the HTML...Please help me someone....Can someone beutify the HTML for me? I suck at html.
rats
Forum Newbie
Posts: 21
Joined: Fri May 31, 2002 5:55 am

Post by rats »

Code: Select all

&lt;?php 

/* devish v0.1 configuration file. 
   developer: micke andersson 
   email: root@g33k.net 
   webpage: http://teksys.joshie.com/ 
*/ 

function theme_Index() { 
global $PHP_ext,$index_file,$main_file,$login_file,$logout_file,$options_file,$function; 
global $preferances_file,$uid,$upass,$name,$site_name,$tbl_color1,$tbl_color2; 
?&gt; 
&lt;!-- theme_Index(); starts here --&gt; 
&lt;/head&gt; 

&lt;body bgcolor="#ffffff"&gt; 

&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt; 
&lt;tr valign="top" align="center"&gt; 
&lt;/td&gt; 
&lt;/table&gt; 

&lt;table width="100%" border="0" cellspacing="0" cellpadding="5"&gt; 
&lt;tr&gt; 
  &lt;td valign="top" width="155"&gt;&lt;table width="155" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000"&gt; 
   &lt;tr&gt; 
    &lt;td width="155"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt; 
     &lt;tr bgcolor="&lt;? print $tbl_color1 ?&gt;"&gt; 
      &lt;td&gt;&lt;b&gt;&lt;p align="center"&gt;&lt;font color="#ffffff"&gt;navigation&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; 
   &lt;/tr&gt; 
&lt;tr bgcolor="#ffffff"&gt; 
  &lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="5"&gt; 
   &lt;tr&gt; 
    &lt;td&gt; 
    &lt;font color="#000000"&gt; 
    &lt;table border="0" width="100%" cellspacing="0" cellpadding="0"&gt; 
&lt;tr&gt;&lt;td&gt; 
&lt;/table&gt; 
&lt;!-- NavigationLinks(); starts here --&gt; 
    &lt;?php NavigationLinks(); ?&gt; 
&lt;!-- NavigationLinks(); ends here --&gt; 
&lt;/font&gt;    &lt;/td&gt; 
   &lt;/tr&gt; 
  &lt;/table&gt;&lt;/td&gt; 
&lt;/tr&gt; 
&lt;?php 
} 

function theme_Nav() { 
global $PHP_ext,$index_file,$main_file,$login_file,$logout_file,$options_file,$function; 
global $preferances_file,$uid,$upass,$name,$site_name, $tbl_color1, $tbl_color2; 
?&gt; 
&lt;!-- theme_Nav(); starts here --&gt; 
&lt;tr&gt; 
  &lt;td width="155"&gt;&lt;table width="155" border="0" cellspacing="0" cellpadding="0"&gt; 
   &lt;tr bgcolor="&lt;? print $tbl_color1 ?&gt;"&gt; 
    &lt;td&gt;&lt;b&gt;&lt;p align="center"&gt;&lt;font color="#ffffff"&gt;&lt;? echo "user: " . user($uid, $upass, "name") . ""; ?&gt;&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; 
   &lt;/tr&gt; 
  &lt;tr bgcolor="#ffffff"&gt; 
   &lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="5"&gt; 
    &lt;tr&gt;&lt;td&gt;&lt;font color="#000000"&gt; 
    &lt;!-- UserLinks(); starts here --&gt; 
    &lt;? UserLinks(); ?&gt; 
    &lt;!-- UserLinks(); ends here --&gt; 
   &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; 
  &lt;/td&gt; 
&lt;/tr&gt; 
&lt;/table&gt; 
  &lt;/td&gt; 
&lt;/tr&gt; 
&lt;/table&gt; 
&lt;/td&gt; 
&lt;?php 
} 

function theme_Usersonline() { 
global $uid,$upass,$name,$tbl_MiscSettings; 
?&gt; 
&lt;!-- useronline(); starts here --&gt; 
&lt;td valign="top" width="100%"&gt; 
&lt;font color="#000000"&gt; 
&lt;dev align="left"&gt;&lt;? if ($tbl_MiscSettings&#1111;random_welcome] == "yes") { random_welcome(); } ?&gt;&lt;/div&gt;&lt;div align="right"&gt;&lt;b&gt;&lt;? if ($tbl_MiscSettings&#1111;usersonline] == "yes") { usersonline(); } ?&gt;&lt;/b&gt; 
&lt;/b&gt;&lt;/div&gt;&lt;/font&gt;&lt;br&gt; 
&lt;center&gt;&lt;img src="&lt;? print $root_path; ?&gt;/misc/images/pixel_black.gif" width="100%" height="1"&gt;&lt;/center&gt; 
&lt;?php 
} 

function theme_News() { 
global $tbl_MiscSettings; 
?&gt; 
&lt;!-- theme_News(); starts here --&gt; 
&lt;table width="100%" border="0" cellspacing="8" cellpadding="0"&gt; 
&lt;tr valign="top"&gt; 
&lt;td valign="top" width="70%"&gt;&lt;font color="#000000"&gt; 
&lt;!-- randomslogan(); starts here --&gt; 
&lt;b&gt;&lt;?php if ($tbl_MiscSettings&#1111;random_slogan] == "yes") { randomslogan(); br(); br(); } ?&gt;&lt;/b&gt; 
&lt;!-- randomslogan(); ends here --&gt; 
&lt;?php include('C:\www\Apache\htdocs\bin\devnews\news.php'); ?&gt; 
&lt;/font&gt;&lt;/td&gt; 
&lt;?php 
} 

function theme_InternalNews() { 
global $result,$total_news,$tables, $tbl_color1, $tbl_color2; 
?&gt; 
&lt;!-- theme_InternalNews(); starts here --&gt; 
&lt;td&gt; 
&lt;td valign="top"&gt; 
  &lt;table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000"&gt; 
   &lt;tr&gt; 
    &lt;td width="100%"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt; 
     &lt;tr bgcolor="&lt;? print $tbl_color1 ?&gt;"&gt; 
    &lt;td&gt;&lt;b&gt;&lt;p align="center"&gt;&lt;font color="#ffffff"&gt;internal news&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; 
   &lt;/tr&gt; 
  &lt;tr bgcolor="#ffffff"&gt; 
   &lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="5"&gt; 
    &lt;tr&gt;&lt;td&gt;&lt;font color="#000000"&gt; 
    &lt;p&gt;&lt;b&gt;&lt;font ize="1"&gt;&lt;/b&gt;&lt;? print "there are '&lt;b&gt;$total_news&lt;/b&gt;' news posts in our table '&lt;b&gt;$tables&#1111;news]&lt;/b&gt;'.&lt;br&gt;"; 
    //br(); 
    //br(); 
    if(file_exists($root_path.'news.txt')) 
   include($root_path.'news.txt'); 
    //include('C:\www\Apache\htdocs\news.txt'); 
    br(); ?&gt;&lt;br&gt;&lt;/font&gt;&lt;/p&gt; 
  &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; 
  &lt;/td&gt; 
&lt;/tr&gt; 
&lt;/table&gt; 
&lt;?php 
} 

function theme_Footer() { 
global $tbl_color1, $tbl_color2; 
?&gt; 
&lt;!-- theme_Footer(); starts here --&gt; 
&lt;tr&gt; 
&lt;table border="0" width="75%" cellspacing="0" cellpadding="1" tr align="center" valign="bottom" bgcolor="&lt;? print $tbl_color1 ?&gt;"&gt; 
  &lt;td width="75%" align="center"&gt;&lt;p align="center"&gt;&lt;b&gt;&lt;font color="#ffffff"&gt; 
  &lt;table border="0" width="75%" cellspacing="0" cellpadding="0"&gt; 
   &lt;tr&gt; 
    &lt;td align="center"&gt;&lt;font color="#ffffff"&gt;&lt;?php 
footer(); ?&gt;&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; 
   &lt;/tr&gt; 
  &lt;/table&gt; 
  &lt;/font&gt;&lt;/td&gt; 
&lt;/tr&gt; 
&lt;/tr&gt; 
&lt;/table&gt; 

&lt;/body&gt; 
&lt;/html&gt; 
&lt;?php 
} 

function Codems_Index() { 
global $tbl_color1, $tbl_color2; 
?&gt; 
&lt;/head&gt; 

&lt;body bgcolor="#ffffff"&gt; 

&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt; 
&lt;tr valign="top" align="center"&gt; 
&lt;font face="Verdana" size="1"&gt;&lt;/font&gt;&lt;/td&gt; 
&lt;/table&gt; 

&lt;table width="100%" border="0" cellspacing="0" cellpadding="5"&gt; 
&lt;tr&gt; 
  &lt;td valign="top" width="155"&gt;&lt;table width="155" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000"&gt; 
   &lt;tr&gt; 
    &lt;td width="155"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt; 
     &lt;tr bgcolor="&lt;? print $tbl_color1 ?&gt;"&gt; 
      &lt;td&gt;&lt;b&gt;&lt;p align="center"&gt;&lt;font face="Verdana" size="1" color="#ffffff"&gt;tekcodesys stats&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; 
   &lt;/tr&gt; 
&lt;tr bgcolor="#ffffff"&gt; 
  &lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="5"&gt; 
   &lt;tr&gt; 
    &lt;td&gt; 
    &lt;font face="verdana" size="1"&gt; 
    &lt;table border="0" width="100%" cellspacing="0" cellpadding="0"&gt; 
&lt;tr&gt;&lt;td&gt; 
&lt;/table&gt; 
&lt;!-- stats starts here --&gt; 
&lt;?php 
// total comments. 
tek_connect(localhost, root, whereisthelegend, codems); // connect to the codems database. 
     $result = mysql_query("select * from phpcodems_comments"); 
     $total = mysql_num_rows($result); 
     echo "Total Comments: &lt;b&gt;$total&lt;/b&gt;&lt;br&gt;"; 
// end total comments. 

echo 'Total Codes: &lt;b&gt;'.get_amount_submissions().'&lt;/b&gt;&lt;br&gt;'; 

// total categories 
     $result = mysql_query("select * from phpcodems_categories"); 
     $total = mysql_num_rows($result); 
     echo "Total Categories: &lt;b&gt;$total&lt;/b&gt;&lt;br&gt;"; 
// end total categories. 

// total users 
     $result = mysql_query("select * from phpcodems_users"); 
     $total = mysql_num_rows($result); 
     echo "Total Users: &lt;b&gt;$total&lt;/b&gt;&lt;br&gt;"; 
// end total users 

?&gt; 
&lt;!-- stats ends here --&gt; 
&lt;/font&gt;    &lt;/td&gt; 
   &lt;/tr&gt; 
  &lt;/table&gt;&lt;/td&gt; 
&lt;/tr&gt; 
&lt;?php 
} 


?&gt;
User avatar
teksys
Forum Commoner
Posts: 34
Joined: Tue May 14, 2002 6:58 pm
Location: Denmark

thanks

Post by teksys »

thanks alot rats, i will try your update right now...surely looks alot better :)

thanks :!:
User avatar
teksys
Forum Commoner
Posts: 34
Joined: Tue May 14, 2002 6:58 pm
Location: Denmark

Post by teksys »

HTML still is corrupt when adding a new theme_Blah function (containing HTML, like, a table...).

I'm hopeless....and my whole login and register system is outdated, so i think i will just delete the whole project (which i have worked for since 1999) and start it all over...this is just too much to update.
User avatar
zorka
Forum Newbie
Posts: 9
Joined: Fri May 24, 2002 8:29 am
Contact:

whew

Post by zorka »

A few pointers:

When you open the following tags, close the following tags:

Code: Select all

<table>
  <tr>
    <td>Cell 1</td><td>Cell 2</td>
  </tr>
</table>
You cannot have tr tags in td tags, that isn't correct HTML. You can embed tables in td cells, but not tr's.

Logically, look at using CONSTANTS instead of variables so you don't have to globalize so much stuff.

Example:

Code: Select all

define(TBCOLOR, "#FFFFFF");

function foo () &#123;
  echo TBCOLOR;  // noticed I didn't have to globalize anything?
&#125;
--ZorKa
User avatar
teksys
Forum Commoner
Posts: 34
Joined: Tue May 14, 2002 6:58 pm
Location: Denmark

Re: whew

Post by teksys »

Ok, that was a nice tip...these variables i use fetches info from the MySQL database, can i do that with the define function aswell?
zorka wrote:A few pointers:

When you open the following tags, close the following tags:

Code: Select all

<table>
  <tr>
    <td>Cell 1</td><td>Cell 2</td>
  </tr>
</table>
You cannot have tr tags in td tags, that isn't correct HTML. You can embed tables in td cells, but not tr's.

Logically, look at using CONSTANTS instead of variables so you don't have to globalize so much stuff.

Example:

Code: Select all

define(TBCOLOR, "#FFFFFF");

function foo () &#123;
  echo TBCOLOR;  // noticed I didn't have to globalize anything?
&#125;
--ZorKa
User avatar
zorka
Forum Newbie
Posts: 9
Joined: Fri May 24, 2002 8:29 am
Contact:

Not really

Post by zorka »

By there very nature when you "define" a constant that is what it is, a constant. It cannot be changed or reassigned and isn't like a variable. Constants also are globally accessible inside of functions and objects and do not have to be globalized which is why I suggested you to use them.

Think how long it would take someone to figure out what all they had to gloablize inside of your functions the way you are writing them now (which looks like a php-nuke style, enough said). If you use constants then all of those will be accessible inside the scope of any function.

--ZorKa
Post Reply