simple php help - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: simple php help (/showthread.php?tid=73188)
simple php help by Supersonicdarky on 04-01-2007 at 02:25 AM
i hardly know any php, so i probably made a silly mistake and everyone's gonna laugh at me ;<
anyways, to make things easier, i decided to split a page up into different sections (in a different file) and included it on every page, but it only shows 3 random characters when it loads ;<
static_content.php
code: <?php
$header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css.css" type="text/css" />
<title>123</title>
</head>'
$body ='<body>
<div id="container">
<div id="header"></div>
<div id="content">'
$sidebar ='<div id="sidebar">
<ul>
<li><a href="novosti.php"><b>123</b></a></li>
<br />
<li><b>123</b></li>
<ul>
<li><a href="detskii_sad.php"><i>• 123</i></a></li>
<li><a href="sybot_shkola.php"><i>• 123</i></a></li>
<li><a href="podgotov_shkola.php"><i>• 123</i></a></li>
<li><a href="klass_taekwon_do.php"><i>• 123</i></a></li>
<li><a href="letnii_lager.php"><i>• 123</i></a></li>
<li><a href="program_do_i_posle.php"><i>• 123</i></a></li>
<li><a href="music_shkola.php"><i>• 123</i></a></li>
<li><a href="shkola_horeographii.php"><i>• 123</i></a></li>
<li><a href="russkii_kak_deti.php"><i>• 123</i></a></li>
<li><a href="francyzskii_deti.php"><i>• 123</i></a></li>
</ul>
<li><b>123</b></li>
<ul>
<li><a href="ansambl_kalinka.php"><i>• 123</i></a></li>
<li><a href="klass_aerobiki.php"><i>• 123</i></a></li>
<li><a href="workshop.php"><i>• Workshop</i></a></li>
<li><a href="russkii_kak_vzros.php"><i>• 123</i></a></li>
<li><a href="francyzskii_vzros.php"><i>• 123</i></a></li>
<li><a href="angliskii.php"><i>• 123</i></a></li>
</ul>
<li><a href="http://www.pokrov.ca/School/schoolalbum.php" target="_blank"><b>123</b></a></li>
<li><a href="adres.php"><b>123</b></a></li>
<li><a href="index.php"><b>123</b></a></li>
</ul>
</div>'
$footer = '</div>
<div id="footer">
<p>© 2007</p>
</div>
</div>
</body>
</html>'
?>
and the page
code: <?php
include'static_content.php';
print $header;
print $body;
?>
<div id="main">
<p>Francyzskii yazik</p>
</div>
<?php
print $footer;
?>
whats wrong? i tried with echo and return, same thing happens ;<
RE: simple php help by Nathan on 04-01-2007 at 02:31 AM
the include should be:
code: include('static_content.php');
or
code: require('static_content.php');
also you should note:
whenever you echo something e.g
code: echo "I am cool";
It must always end with ; (after the ' or ") otherwise it doesnt know what to do.
RE: simple php help by NanaFreak on 04-01-2007 at 02:35 AM
maybe try this:
code: <?php
$header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css.css" type="text/css" />
<title>123</title>
</head>';
$body ='<body>
<div id="container">
<div id="header"></div>
<div id="content">';
$sidebar ='<div id="sidebar">
<ul>
<li><a href="novosti.php"><b>123</b></a></li>
<br />
<li><b>123</b></li>
<ul>
<li><a href="detskii_sad.php"><i>• 123</i></a></li>
<li><a href="sybot_shkola.php"><i>• 123</i></a></li>
<li><a href="podgotov_shkola.php"><i>• 123</i></a></li>
<li><a href="klass_taekwon_do.php"><i>• 123</i></a></li>
<li><a href="letnii_lager.php"><i>• 123</i></a></li>
<li><a href="program_do_i_posle.php"><i>• 123</i></a></li>
<li><a href="music_shkola.php"><i>• 123</i></a></li>
<li><a href="shkola_horeographii.php"><i>• 123</i></a></li>
<li><a href="russkii_kak_deti.php"><i>• 123</i></a></li>
<li><a href="francyzskii_deti.php"><i>• 123</i></a></li>
</ul>
<li><b>123</b></li>
<ul>
<li><a href="ansambl_kalinka.php"><i>• 123</i></a></li>
<li><a href="klass_aerobiki.php"><i>• 123</i></a></li>
<li><a href="workshop.php"><i>• Workshop</i></a></li>
<li><a href="russkii_kak_vzros.php"><i>• 123</i></a></li>
<li><a href="francyzskii_vzros.php"><i>• 123</i></a></li>
<li><a href="angliskii.php"><i>• 123</i></a></li>
</ul>
<li><a href="http://www.pokrov.ca/School/schoolalbum.php" target="_blank"><b>123</b></a></li>
<li><a href="adres.php"><b>123</b></a></li>
<li><a href="index.php"><b>123</b></a></li>
</ul>
</div>';
$footer = '</div>
<div id="footer">
<p>© 2007</p>
</div>
</div>
</body>
</html>';
?>
code: <?php
include('static_content.php');
echo $header;
echo $body;
echo $sidebar;
?>
<div id="main">
<p>Francyzskii yazik</p>
</div>
<?php
echo $footer;
?>
added some ; into the first one after the ended variables (they should be making errors if they werent there...)... also changed to echo
RE: simple php help by Supersonicdarky on 04-01-2007 at 02:38 AM
but according to this what i was doing is correct...
and neither work...
@nathan: " and " aren't used for $vars
---
yay, works! thnx nana dude =]
RE: simple php help by Nathan on 04-01-2007 at 02:40 AM
see my updated post...
RE: simple php help by NanaFreak on 04-01-2007 at 02:46 AM
quote: Originally posted by Supersonicdarky
@nathan: " and " aren't used for $vars
if you use " (double quote not ' x2) then you are able to use $vars but not if you use '
quote: Originally posted by Supersonicdarky
yay, works! thnx nana dude =]
np
RE: simple php help by Nathan on 04-01-2007 at 02:48 AM
Originally posted by Supersonicdarky
yay, works! thnx nana dude =]
*cough* I explained what to do, nanafreak just gave you the code
RE: simple php help by NanaFreak on 04-01-2007 at 02:50 AM
quote: Originally posted by Nathan
Originally posted by Supersonicdarky
yay, works! thnx nana dude =]
*cough* I explained what to do, nanafreak just gave you the code
*cough*quote: Originally posted by NanaFreak
added some ; into the first one after the ended variables (they should be making errors if they werent there...)... also changed to echo
*cough*
RE: simple php help by Supersonicdarky on 04-02-2007 at 11:55 PM
something is being very retarted
look in ie, then click any link.
where does the random < or w.e come from?
source of:
inde.php
code: <?php
include('static_content.php');
echo $header;
echo $body;
echo $sidebar;
?>
<div id="main">
<h1>Blah</h1>
</div>
<?php
echo $footer;
?>
detskii_sad.php
code: <?php
include('static_content.php');
echo $header;
echo $body;
echo $sidebar;
?>
<div id="main">
<p>Detskii sad</p>
</div>
<?php
echo $footer;
?>
static_content.php
code: <?php
$header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css.css" type="text/css" />
<title>123</title>
</head>';
$body ='<body>
<div id="container">
<div id="header"></div>
<div id="content">';
$sidebar ='<div id="sidebar">
<ul>
<li><a href="o_centre.php"><b>123</b></a></li>
<br />
<li><b>123</b></li>
<ul>
<li><a href="detskii_sad.php"><i>• 123</i></a></li>
<li><a href="sybot_shkola.php"><i>• 123</i></a></li>
<li><a href="podgotov_shkola.php"><i>• 123</i></a></li>
<li><a href="klass_taekwon_do.php"><i>• 123</i></a></li>
<li><a href="letnii_lager.php"><i>• 123</i></a></li>
<li><a href="program_do_i_posle.php"><i>• 123</i></a></li>
<li><a href="music_shkola.php"><i>• 213</i></a></li>
<li><a href="shkola_horeographii.php"><i>• 123</i></a></li>
<li><a href="russkii_kak_deti.php"><i>• 123</i></a></li>
<li><a href="francyzskii_deti.php"><i>• 123к</i></a></li>
</ul>
<li><b>123</b></li>
<ul>
<li><a href="ansambl_kalinka.php"><i>• 123</i></a></li>
<li><a href="klass_aerobiki.php"><i>• 123</i></a></li>
<li><a href="workshop.php"><i>• 123</i></a></li>
<li><a href="russkii_kak_vzros.php"><i>• 123</i></a></li>
<li><a href="francyzskii_vzros.php"><i>• 123</i></a></li>
<li><a href="angliskii.php"><i>• 123</i></a></li>
</ul>
<li><a href="schoolalbum.php" target="_blank"><b>123</b></a></li>
<li><a href="adres.php"><b>123</b></a></li>
<li><a href="index.php"><b>123</b></a></li>
</ul>
</div>';
$footer = '</div>
</div>
<div id="footer">
<p>© 2007</p>
</div>
</body>
</html>';
?>
look here (first error) or look at source in ie to see what i'm talking about
i'm guessing that will solve the retartedness when you click a link
edit: everything saved as utf-8
|