SSupreme
asked on
php website basics
I have website with 5 pages pure HTML at this moment, but I will need to add 20 more pages soon and it becomes quite difficult to maintain.
I got an idea to use php, I need to change some meta tags and entry of page.
How can I do this? With include function?
Here is example:
<head>
<title>XXXXXXXXXXXXXXXX</t itle>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
<meta name="keywords" content="XXXXXXXXXXXXXXXXX XXXXXXX" />
<meta name="description" content="XXXXXXXXXXXXXXXXX XXXX" />
<meta http-equiv="content-type" content="text/html;charset =utf-8" />
<meta http-equiv="cache-control" content="Public" />
<link href="bagachst.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div id="wrapper" >
<div id="header">
<div id="logo">
<p>xxxxxxxxxxx</p>
</div>
<div id="menu">
<ul>
<li><a href="index.html">xxxxx</a ></li>
<li><a href="about.html">xxxxx</a ></li>
<li><a href="gallery.html">xxxxx< /a></li>
<li><a href="prices.html">xxxxx</ a></li>
<li><a href="contact.html">xxxxx< /a></li>
</ul>
</div>
</div>
<div id="page">
<div class="post" id="content">
<h1 class="title">xxxxxxxxxx</ h1>
<p class="meta"></p>
<div class="entry">
<p>
xxxxxxxxxxxxxxxxxxxxxxxxxx - 25 xxxxxxxxxxxxxxxxxx</p>
<p>xxxxxxxxxxxxxx-1 xxx-15 xxxxxxxx (xxxxxxxxxxxx 10 xxxxxxxxx)</p>
<p>xxxxx xxxxx 3 xxxxxxxx xxxxx xxxxxxxx, 3-15 x xx 10 x x.</p>
<p>xxxxxxxxxxxxxx xxxxxxxxxxxxx xxxxxxxx:<br />
<ul>
<li>xxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxx</li>
<li>xxxxxxx</li>
<li>xxxxxxxxxxxxxxxxx xxxxxxxx</li>
<li>xxxxxxx</li>
<li>xxxxxxxxxxxxxxxxxxxx</ li>
</ul>
</p>
</div>
</div>
</div>
</div>
<div id="bgbottom" >
<div id="footer" >
<p>Copyright © 2010-2011.</p>
</div></div>
<div id="bglayout" ><div id="bgtop" ><div id="bgmenu" ><div class="left" ></div><div class="right" ></div></div></div></div>
</body>
</html>
I need to change only bold parts.
Any help please.
I got an idea to use php, I need to change some meta tags and entry of page.
How can I do this? With include function?
Here is example:
<head>
<title>XXXXXXXXXXXXXXXX</t
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
<meta name="keywords" content="XXXXXXXXXXXXXXXXX
<meta name="description" content="XXXXXXXXXXXXXXXXX
<meta http-equiv="content-type" content="text/html;charset
<meta http-equiv="cache-control"
<link href="bagachst.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div id="wrapper" >
<div id="header">
<div id="logo">
<p>xxxxxxxxxxx</p>
</div>
<div id="menu">
<ul>
<li><a href="index.html">xxxxx</a
<li><a href="about.html">xxxxx</a
<li><a href="gallery.html">xxxxx<
<li><a href="prices.html">xxxxx</
<li><a href="contact.html">xxxxx<
</ul>
</div>
</div>
<div id="page">
<div class="post" id="content">
<h1 class="title">xxxxxxxxxx</
<p class="meta"></p>
<div class="entry">
<p>
xxxxxxxxxxxxxxxxxxxxxxxxxx
<p>xxxxxxxxxxxxxx-1 xxx-15 xxxxxxxx (xxxxxxxxxxxx 10 xxxxxxxxx)</p>
<p>xxxxx xxxxx 3 xxxxxxxx xxxxx xxxxxxxx, 3-15 x xx 10 x x.</p>
<p>xxxxxxxxxxxxxx xxxxxxxxxxxxx xxxxxxxx:<br />
<ul>
<li>xxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxx</li>
<li>xxxxxxx</li>
<li>xxxxxxxxxxxxxxxxx xxxxxxxx</li>
<li>xxxxxxx</li>
<li>xxxxxxxxxxxxxxxxxxxx</
</ul>
</p>
</div>
</div>
</div>
</div>
<div id="bgbottom" >
<div id="footer" >
<p>Copyright © 2010-2011.</p>
</div></div>
<div id="bglayout" ><div id="bgtop" ><div id="bgmenu" ><div class="left" ></div><div class="right" ></div></div></div></div>
</body>
</html>
I need to change only bold parts.
Any help please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
page.php can be copied to as many pages as you need, including index.php. Those are called by clients.
template.php, or better call it template.inc.php, is not intend to be called by a client directly, but in this case it is would be no problem.
If naming it template.inc.php you can add the following lines to your .htaccess to deny access to any .inc.php files
template.php, or better call it template.inc.php, is not intend to be called by a client directly, but in this case it is would be no problem.
If naming it template.inc.php you can add the following lines to your .htaccess to deny access to any .inc.php files
<Files "*.inc.php">
Order allow,deny
Deny from all
</Files>
ASKER
Obviously you answered the question.
But how page.php will call template.php, does it know that template.tpl is template.php?
Thank you very much indeed.
But how page.php will call template.php, does it know that template.tpl is template.php?
Thank you very much indeed.
Nope, that was a typo. The include command must have the exact filename of your template file.
If you call it template.tpl.php (as I do usually), you have to write include('template.tpl.php' ); if you name it template.inc.php, it's include('template.inc.php' ); and so on.
If you call it template.tpl.php (as I do usually), you have to write include('template.tpl.php'
ASKER
Thanks! I got it logically. I wanted to be sure.
ASKER
template.php should be used as it is;
page.php I can fill with whatever I like and create same pages with different content for other pages, like index.php?
Do I need to worry about template.tpl?