(I'm a complete novice programmer)
I recently came across a problem with my custom CMS. I want to make it SEO friendly so I tried to echo out the title by the page loaded e.g.
www.blaa.com/index.php?page=about
//code here grabs the required page title from the mysql db $title = $row['title'];
<title><?php echo $title; ?></title>
I can't see if this actually worked because when I view source it only displays this code:
<table>
<tr><td>Custom Module<br><br>
My custommodule cus any html goes in here
</td></tr>
<tr><td>Menu Body <br><br>
<a href='home.html'> home</a><br><a href='about page.html'> about page</a><br><br><br> </td></tr>
<tr><td>body<br>
cant believe im so a<br></div>
</td></tr>
<tr><td>Footer<br>
links go here to various pages<br></td></tr>
</table>
Is there a way to make all of the HTML code display in the view source?
You have to
echo
orprint
a variable to show it. You could also do avar_dump
to check what the values are.I added
htmlspecialchars
to prevent script injection, I don't know if it would work in thetitle
tag but I added it just in case. Plus you should know whenever you write user input into your HTML page you should use htmlspecialchars to cancel out any html code & scripts.If your custom module is a load of HTML you wanted to display, you should use the
inlude
command: