Forum Moderators: coopster

Message Too Old, No Replies

large variables, templates and best practice

         

jamie

8:32 am on Aug 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



i am still planning how best to change the bulk of our site to dynamic.

we have too many pages indexed in the SEs to start mucking around with a new URL system, so i am going to keep the same URLs.

originally i wanted to strip all of my html pages, leaving just the content, and then to include a header and footer file.

however, i really like the idea of keeping all the page design elements together, so that this design can be changed with minimum of fuss by non-programmers. this would mean using a template

<html>
<head>
<title><?=$title?></title>
</head>
<body>
<div><?=$navbar?></div>
<div><?=$content?></div>
<div><?=$sidebar?></div>
</body>
</html>

which i would then include() at the bottom of each of my html pages, and then echo out the appropriate $variables which i had defined in the page above the include.

the problem is, some of the $variables would hold a large ammount of information. e.g. $content could be 8 long paragraphs of text.

i have read that variables are stored in ram, so if i start storing too many large variables in ram, would i start running out of ram and would the page creation of my site start slowing down?

should i unset() all these variables directly underneath where i include the template? or is that not necessary?

hope this is understandable ;-)

many thanks!

panic

11:15 pm on Aug 21, 2003 (gmt 0)

10+ Year Member



Whoa... you said a mouthful. Let's focus on the ONE important thing at hand : LARGE VARIABLES!

When someone tells you about large variables, they're talking about variables that contain at least a few megs of information.

Just a few paragraphs wont put a strain on your server at all!

Unless those few paragraphs contain a few megs of information... but if that were the case, I'd definitely do some editing :P

And no... unsetting variables is unnecessary. PHP unsets the variables after the PHP file has completely loaded and executed.

-panic

jamie

7:29 am on Aug 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



panic,

many many thanks! that has put a lot of my mind at rest ;-)

my 'large' vars contain 8 paras of info LOL