I'm trying to use the same basic article backdrop for each article on my site. For this I use the include function. One problem I'm running into is all the <head> stuff (meta, title). I don't want each article to have two different files since that would create a lot of extra work for me and the reason why I'm doing this in the first place is to save time if I ever redesign my site. Anyway, one way of getting around this would be to use functions. w3 says that you can call a function from anywhere within the document, but that's not true. If I call it before I declare it, it won't know what to do and pretty much "erase" the rest of the document from that point onward when it tries to display it. Here's the code:
****************Article design page*****************
<html>
<head>
<?php
metafun($head);
?>
</head>
<body>
<?php
include "ArticleTemplate.txt";
?>
</body>
</html>
***************article file itself*******************
<?php
$head = "<meta name=description content=hello>";
?>
hi
<?php
function metafun($head){
echo $head;
}
?>
*****************
If this was C it should work, but it's not and it doesn't. Any alternatives out there?
#php
Send Free SMS Text Messages from your Computer
Send Free SMS Text Messages from your Computer