|
|
|
|
![]() ![]() |
May 1 2006, 09:12 PM
Post
#1
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 141 Joined: 25-April 06 Member No.: 22,477 |
Here is a very simple way to maintain many webpages without using a content management system (CMS). One of the advantages to this is you can change templates very easily. Your article would be in a separate file, for an example we'll create a file called my_page_article.php
CODE <? $PageTitle = "My Page"; $articleDescription = "This is my page"; $articleTitle = "All about my page"; $articleKeywords = "my page"; $articleBody ='<strong>Welcome to my page.<br> This is <a href="http://www.google.com" target="_blank">Google</a>!</strong>'; ?> Next, we design a template and enter our variables where we want them. As an example and to save space, here is a very plain template. For our article above we'll name it my_page.php CODE <? include ("article.php"); ?> <html> <head> <title><? echo "$pageTitle"; ?></title> <META NAME="description" CONTENT="<? echo "$pageDescription"; ?>"> <META NAME="keywords" CONTENT="<? echo "$articleKeywords"; ?>"> <META NAME="revisit-after" CONTENT="7 days"> <META NAME="robots" CONTENT="index, follow"> <META NAME="rating" content="general"> <META NAME="distribution" content="global"> </head> <body> <p><? echo $articleTitle; ?></p> <p><? echo $articleBody; ?></p> </body> </html> Such a simple template system as the above can be expanded upon to use mySQL to store all the info instead of the first file listed above. But, for a quick and dirty way of getting a large number of pages up in a short time, this works pretty well. But now you're probably saying, "ok, now I have 100 pages all ready to upload. What about an index page?" No problem! We'll make the index.php like this CODE <? $indexTitle = "My Page Index"; $pageDescription = "This is my page index"; $pageKeywords = "my page,my index'; $articleTitle1 = "My 1st Article"; $articleLink2 = "my_article_1.php; $articleDecrip_1 = "Learn all about apples and oranges"; $articleTitle2 = "My 2nd Article"; $articleLink2 = "my_article_2.php; $articleDecrip_2 = "Learn all about peaches and pears"; $articleTitle3 = "My 3rd Article"; $articleLink2 = "my_article_3.php; $articleDecrip_2 = "Learn all about rocks and rolls"; <html> <head> <title><? echo "$indexTitle"; ?></title> <META NAME="description" CONTENT="<? echo "$pageDescription"; ?>"> <META NAME="keywords" CONTENT="<? echo "$pageKeywords"; ?>"> <META NAME="revisit-after" CONTENT="7 days"> <META NAME="robots" CONTENT="index, follow"> <META NAME="rating" content="general"> <META NAME="distribution" content="global"> </head> <body> <a href="<? echo $articleLink1 ?>"><? echo $articleTitle1; ?><br> <? echo $articleDescription1; ?><br><br> <a href="<? echo $articleLink2 ?>"><? echo $articleTitle2; ?><br> <? echo $articleDescription2; ?><br><br> <a href="<? echo $articleLink3 ?>"><? echo $articleTitle3; ?><br> <? echo $articleDescription3; ?><br><br> <!-- you can add more pages by doing this --> <a href="index.php">1</a> - <a href="index-2.php">2</a> - <a href="index-3.php">3</a> </body> </html> and there's your template/guideline for making an index page for all your articles. |
|
|
|
May 16 2006, 08:23 PM
Post
#2
|
|
|
Newbie [Level 2] ![]() ![]() Group: Members Posts: 25 Joined: 16-May 06 Member No.: 23,733 |
Looks good though some people dont like to use single quotes will have to slash their double quotes (EX: " will be \") which you will have to do if you use the code from my_page_article.php
CODE $articleBody ='<strong>Welcome to my page.<br> This is <a href="http://www.google.com" target="_blank">Google</a>!</strong>'; The easisest and most user friendly way would to have the information they want as the body to be stored in a MySQL database. Then just retrieve the data and set it as $articleBody and it'd work just as great but with no hassle |
|
|
|
May 30 2006, 12:48 AM
Post
#3
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 12 Joined: 29-May 06 Member No.: 24,489 |
Yes this is a nice solution. But please think about it for a second. Is it really worth the time and effort? That method could be viable if your time costs nothing. In any other case you are better off using mysql. God forbid that your site would be successful and would become bigger in size. Who would administer all that content I do not know.
Still - a nice exercise in clean design. |
|
|
|
May 30 2006, 02:19 AM
Post
#4
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,868 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
If you think about it. This is like manual-CMS. Nice planned-out alternative, though. May be useful for many.
|
|
|
|
May 30 2006, 02:42 PM
Post
#5
|
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 30-May 06 Member No.: 24,522 |
Here is a very simple way to maintain many webpages without using a content management system (CMS). One of the advantages to this is you can change templates very easily. Your article would be in a separate file, for an example we'll create a file called my_page_article.php CODE <? $PageTitle = "My Page"; $articleDescription = "This is my page"; $articleTitle = "All about my page"; $articleKeywords = "my page"; $articleBody ='<strong>Welcome to my page.<br> This is <a href="http://www.google.com" target="_blank">Google</a>!</strong>'; ?> Next, we design a template and enter our variables where we want them. As an example and to save space, here is a very plain template. For our article above we'll name it my_page.php CODE <? include ("article.php"); ?> <html> <head> <title><? echo "$pageTitle"; ?></title> <META NAME="description" CONTENT="<? echo "$pageDescription"; ?>"> <META NAME="keywords" CONTENT="<? echo "$articleKeywords"; ?>"> <META NAME="revisit-after" CONTENT="7 days"> <META NAME="robots" CONTENT="index, follow"> <META NAME="rating" content="general"> <META NAME="distribution" content="global"> </head> <body> <p><? echo $articleTitle; ?></p> <p><? echo $articleBody; ?></p> </body> </html> Such a simple template system as the above can be expanded upon to use mySQL to store all the info instead of the first file listed above. But, for a quick and dirty way of getting a large number of pages up in a short time, this works pretty well. But now you're probably saying, "ok, now I have 100 pages all ready to upload. What about an index page?" No problem! We'll make the index.php like this CODE <? $indexTitle = "My Page Index"; $pageDescription = "This is my page index"; $pageKeywords = "my page,my index'; $articleTitle1 = "My 1st Article"; $articleLink2 = "my_article_1.php; $articleDecrip_1 = "Learn all about apples and oranges"; $articleTitle2 = "My 2nd Article"; $articleLink2 = "my_article_2.php; $articleDecrip_2 = "Learn all about peaches and pears"; $articleTitle3 = "My 3rd Article"; $articleLink2 = "my_article_3.php; $articleDecrip_2 = "Learn all about rocks and rolls"; <html> <head> <title><? echo "$indexTitle"; ?></title> <META NAME="description" CONTENT="<? echo "$pageDescription"; ?>"> <META NAME="keywords" CONTENT="<? echo "$pageKeywords"; ?>"> <META NAME="revisit-after" CONTENT="7 days"> <META NAME="robots" CONTENT="index, follow"> <META NAME="rating" content="general"> <META NAME="distribution" content="global"> </head> <body> <a href="<? echo $articleLink1 ?>"><? echo $articleTitle1; ?><br> <? echo $articleDescription1; ?><br><br> <a href="<? echo $articleLink2 ?>"><? echo $articleTitle2; ?><br> <? echo $articleDescription2; ?><br><br> <a href="<? echo $articleLink3 ?>"><? echo $articleTitle3; ?><br> <? echo $articleDescription3; ?><br><br> <!-- you can add more pages by doing this --> <a href="index.php">1</a> - <a href="index-2.php">2</a> - <a href="index-3.php">3</a> </body> </html> and there's your template/guideline for making an index page for all your articles. nice |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 26th July 2008 - 09:37 AM |