Forum Moderators: coopster
I have a content page, and a template page, ok. Now... I want to make one page for most of the dynamic aspects of my site (top sides and bottom portions and title). Questions on that...
How do I call it up, from the content page... or from the template? If the content page... where... and if the template.. where... (i.e. after the template is called, before the variables are called, etc).
Also how do you program HTML coding in php variables?
I know ' and " do two separate things.. but what does each do i forget -.-
Now if I have something like:
<td valign=top width="450">
<div align=center>
<table cellspacing=1 cellpadding=3 width="100%" bgColor=#000033 border=0>
<tr>
<td width="100%" bgColor=#000066><font color=#9FCDFF><center><b>News & Updates</b></center></font></TD></TR>
<tr>
<td width="100%" bgcolor=#F0F7FF>
can taht go into a variable like:
$code = "
--Code abover here all spaced out etc--
";
or would that cause a problem.
Thank you
That would cause a problem.
Only because it's missing a semicolon. Otherwise it will work just fine and be *much* faster [webmasterworld.com] than using the heredoc syntax.
Easier and marginally faster still is to use
$code = '
<p class="important">This is important text</p>
';
because you don't have to escape the quote marks around attributes as you would with
$code = "
<p class=\"important\">This is important text</p>
";
I know ' and " do two separate things
They do the same thing differently. Both delimit string literals, but " allows variable substition, new lines and so on, whereas ' has no substitution and only lets you escape ' So these are equivalent
echo "\nthis is a string on two \n but \\not three lines with a $variable_word in it and an errant \\ in front of the word 'not'";
echo "\nthis is a string on two \n but \\not three lines with a " . $variable_word . " in it and an errant \\ in front of the word 'not'\n";
echo 'this is a string on two' . "\n" . 'but \not three lines with a ' . $variable_word . ' in it and an errant \\ in front of the word \'not\'';
My second post is just demonstrating the difference between the way single and double quotes work. Look closely at the differences.
Tom
Anyway i noticed you had:
<p="Important"> is important an actual command?
Also i may start a new thread on this... but i have this problem.
First the background:
I have a page with variables (content). This calls up the template page that calls the variables.
ok easy enough but... i'm going to need to call up... a few more pages with variables. (making updates easier). I don't know how to do that though... I can call up a template page and have that call variables that exist on the page calling the template (if that makes sense) but i dont' know how to take a few variables out of a page.
Do you konw how i'd do taht, and where the code to call up the variables and page would go? if u need the code i'll show u.