|
Content Management tutorials
|
|---|
Universal header/footer with dynamic title
Make a CMS from Scratch
Learn how to make an easy to manage and edit Content Management System (CMS) from scratch! Using PHP and MySQL, and .inc files for easy updating.
| | Hits:719 Rate: 2.5(out of 5) Vote:3 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
PHP News Content Management System (CMS)
This tutorial is an in depth tutorial that will teach you everything you need to know about a basic CMS for news!
| | Hits:479 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
PHP MySQL Tutorial System
Learn how to make your own Tutorial system using PHP and MySQL. This can also apply to making affiliate, button, or any other kinds of information systems
| | Hits:461 Rate: 3.0(out of 5) Vote:2 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
Simple News-Driven Site
Lern to make your very own news driven site.
A Simple News-Driven Site
by enygma
The goal of this tutorial, as you probably guessed by the title, is to help you (yes you) create your very own news-driven web site. Now, this doesn't have to be a system as glorified as something like Slashdot or some of the other big news sites. All you may need is a simple system for displaying news and for editing/adding news to the front page. Well, look no further - I will show you how to create a nice simple news-driven site using nothing but some pretty simple PHP and a MySQL database. Now, this can be done without a database by using a text file or something, but that's a bit more difficult. You'd have to write something to parse out the info you needed and something to put it in the right place when you were adding to it. For the sake of ease, we're going to use a simple MySQL database. I'm not going to get into the basics of setting up a database, though. I'm going to assume that you have a good grasp on this and that I can move on. Here's the database you need to create: CREATE TABLE news( author VARCHAR(20), date INT, content TEXT, ID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(ID) ) If you make a database and put this table in it, that should be all that you need as far as the MySQL backend. This simple layout can be changed a bit depending on what you want to do with it, but this is usually a good basic structure. The author is, obviously, the person writing the news item and can be put in several ways. I have a setup on one of my sites that automagically puts the author in based on the username entered when you access one of the files behind the .htaccess protected directory. The date field is a very fun one for later on. It will help us to order the entries and make them a bit more orderly. The integer stored in this field will actually be a UNIX timestamp. PHP can work with these much more easily than some other strangely formatted numbers. Plus, it has the added benefit of being able to be evaluated with the normal math functions too. It would be much harder to find the time difference of something formatted like 00:00:00 versus a nice timestamp formatted with just numbers and no special characters. UNIX timestamps are done in seconds, so you can easily multiply it out and get the hours, days, weeks, etc for any comparison that you'd want to make. The content field allows us to put in a great deal of text. If you're just going to need it for short front page notes or something, you might consider lowering the requirements and using something like VARCHAR or the like instead of TEXT. That last part on the end there is simply an auto-increment field. I, by habit, stick one on every database that I make. It helps to keep things a bit more organized and helps you keep your sanity when you just need an easy field to key off of. Well, that should be the database setup - you really don't need much else on this end to get the backend going. Now, on to the actual PHP code. I'm going to give you an example and then explain it so that you can see the thoughts behind it: $db=mysql_connect("localhost","user","pass") or die ("cant connect"); mysql_select_db("database",$db) or die ("cant change"); $news=mysql_query("select * from news ORDER BY date DESC LIMIT 8") or die ("cant get em"); while($rows=mysql_fetch_array($news)){ $date=date("F d, Y H:i ",$rows["date"]); $author=$rows["author"]; $number="100%"; printf("n",$number); echo " $title n"; echo " $date
n"; echo " by $author
$content
n"; } We'll step through this code, giving a bit of explanation as we go along for each part. First off: $db=mysql_connect("localhost","user","pass") or die ("cant connect"); mysql_select_db("database",$db) or die ("cant change"); $news=mysql_query("select * from news ORDER BY date DESC LIMIT 8") or die ("cant get em"); This code is what's used to connect to the database, select it and send the query to the server. The query basically says to "select all of the matches from news, order them by the date field in descending order, but only get eight." Pretty simple, eh? ORDER BY can be a very powerfulthing. In fact, before I knew about it (back when even I was a newbie), I had to try to write my own function in PHP to compensate. Don't do that - it's not fun. Anyway, on to the next block of code: while($rows=mysql_fetch_array($news)){ $date=date("F d, Y H:i ",$rows["date"]); $author=$rows["author"]; $number="100%"; printf("n",$number); echo " $title n"; echo " $date
n"; echo " by $author
$content
n"; } Now, while this might look a little bit scary, it's really not. It's all encased inside a nice while loop that goes until it's gotten all of the info out of the "select" that we did earlier. Now, since we put the timestamp in the date field, we can pull it out and use the date() function in PHP to format it. In this case, "Month day, year hour:minutes" - there are several different ways to format all o
| | Hits:197 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
PHP by example
Throughout two separate parts in this series, the author demonstrates step by step the fundamental principles of PHP in an original real-world Web site example. The Part 1 offers the basics of PHP and features a Webzine that includes an author's page where content providers can enter the text of articles, as well as a front end for presenting this content to the world. In Part 2 of this series, you'll be shown the delivery module presents a menu of stories to the reader, and how the authoring module permits authors to submit stories to a Webzine.
As a language for building dynamic Web pages, PHP offers a implified method for constructing complex and powerful Web-related programs.Step by step, Erik demonstrates the fundamental principles of PHP in an original, real-world Web site example. Part 1 of this two-part series offers the basics of PHP and features a Webzine that includes an author's page where content providers can enter the text of articles, as well as a front end for presenting this content to the world.
| | Hits:180 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
How to use the PEAR ITX templating system
This tutorial will explain and demonstrate how to use the ITX templating system from the PEAR collection of useful classes for PHP. As we go along, it'll show you some of the competitors, why the author didn't like them and why in the end he chooses to work with ITX in his own scripts. We will build a simple example script that will load and fill out the data out of a database. This script will use another PEAR component, a database abstraction layer. This tutorial assumes that you are familiar with PEAR's DB abstraction layer.
How to use the PEAR ITX templating system
This tutorial will explain and demonstrate how to use the ITX templating system from the PEAR collection of useful classes for PHP. As we go along, it'll show you some of the competitors, why the author didn't like them and why in the end he chooses to work with ITX in his own scripts. We will build a simple example script that will load and fill out the data out of a database. This script will use another PEAR component, a database abstraction layer. This tutorial assumes that you are familiar with PEAR's DB abstraction layer.
| | Hits:160 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
Header and Footer Inclusion for Beginners
Let's pretend you have 10 pages in your site with the same design and you want to change a link in your menu. You would have to edit all 10 pages, right? Nope, there's a much quicker way allowing you to edit just one file and it's not as hard as it sounds. What we have to do is create a header file and a footer file. The header file contains all the HTML code for the top portion of your site. The footer contains the HTML for the bottom. Content goes between the header and footer. Let's get started...
Let's pretend you have 10 pages in your site with the same design and you want to change a link in your menu. You would have to edit all 10 pages, right? Nope, there's a much quicker way allowing you to edit just one file and it's not as hard as it sounds.
What we have to do is create a header file and a footer file. The header file contains all the HTML code for the top portion of your site. The footer contains the HTML for the bottom. Content goes between the header and footer. Let's get started...
This is an entire HTML document to give you an idea of what the header and footer are and where the content fits in. The header is in blue, content is in red, and footer is in green.
| | Hits:157 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
DeveloperWorks: Getting to know Midgard
BM's DeveloperWorks website has a nice tutorial on Midgard. Written by David Seager, a software engineer at IBM, the article describes setting up a basic Midgard site. The article also does a good job of setting up a general context for what Midgard is and how it works.
| | Hits:145 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
PHP-browserdetecting script
This tutorial explains how to identify IE4+ or NS4+ on a windows 32 bit platform (all else is "OtherBrowser") and include different html Web pages for different browser types using PHP.
A browserdetecting script for PHP that decides wich files that should be included,
As I started with my php-site I needed something that could identify what browser the visitor was using.
Why? Because I'm using three different types of navigation styles on my site, one that's IE4+ only, one for NS4+ and one for the rest. When you are using javascript, there's a lot of different browserdetectors to use, but I had difficulties finding one for php.
Finally I found one that got me started, it didn't work as I wanted so I modified it a lot. Here I'll present it and try to walk you through it.
What did I need to start modifying this?
Well, I started everything by making a simple javascript that I could run in different browsers, It writes out exactly what the different navigator objects contains, this way it's a lot easier to know what to test for.
Here is what your current browser contains:
The appname of the current browser is: Microsoft Internet Explorer
The appcodename of the current browser is: Mozilla
The appversion of the current browser is: 4.0 (compatible; MSIE 6.0; Windows NT 5.1)
The useragent of the current browser is: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
The appminorversion of the current browser is: ;SP2;
| | Hits:136 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
|---|
remotely hosted script
This example shows how you can create a remotely hosted script that will display links on a site. The script is created on a site with php scripting and the a single line of JavaScript code allows the content to be displayed on other sites , they dont require PHP. Create links once and copy to all of your sites.
OK you have a set of affiliate links but damn you havesites that do not allow PHP for example free hosts or you wish to create a simple scheme where links or content is displayed on other peoples sites . How do you do this , well with a bit of JavaScript and PHP , no problem.
| | Hits:125 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-18 Rate It | Error | Review |
|
| | | |
| |
Pages : 1 2 |