PHP Programming/smarty/tutorials/simple

From Wikibooks, open books for an open world
< PHP Programming‎ | smarty‎ | tutorials
Jump to: navigation, search

This tutorial is written by User:Wykis and may be used in any educational and non-commercial way. Please add comments in Talk:Programming:PHP:smarty:tutorials:simple and if you modify this tutorial, please add your name below:

Please note that the script is not tested as i don't have a lot of time for this, so check for errors. Best place to ask on is [[irc://irc.freenode.org/php.

  1. index.tpl as necessary ( notice the $db in index.php, change it to your settings!
  2. Now, using y

== our MySQL Client ([[1]]/[[2]] or other tools), add new rows in your table, with content and it's title. Try it with three at the start.

  1. Now, go to your

== directory Web

site through your Web Browser ( you might need to upload it to your web server or set one up on your computer ) ;)[edit]

]] If you have any problems, go to ask on IRC [[3]] or contact me. I haven't tested this script yet so you might find some small mistakes.

  1. For the later versions of Mysql use the following code
CREATE TABLE `test_content` (
 `content_id` INT(11) NOT NULL AUTO_INCREMENT, 
 `content_title` VARCHAR(255) NOT NULL, 
 `content_date` DATETIME NOT NULL, ==

 `content_content` TEXT ==
NOT NULL, 
 `content_position` INT(11) NOT NULL,
 PRIMARY KEY (`content_id`)
)
TYPE = myisam;