This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorials:zencartmods:quotes.html [2011/06/29 19:57] daigo |
tutorials:zencartmods:quotes.html [2016/01/28 18:05] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ==== Put a random quote on your zen cart template ==== | ||
+ | {{:tutorials:zencartmods:quote.png}} | ||
=== Create the Table === | === Create the Table === | ||
Line 24: | Line 26: | ||
Find the place in the template where you'd like to insert the random quote, and add these lines: | Find the place in the template where you'd like to insert the random quote, and add these lines: | ||
+ | in file **includes/templates/YOUR_TEMPLATE/tpl_SOME_FILE.php** | ||
<code php> | <code php> | ||
$quote_sql = $db->Execute("SELECT * from quotes WHERE quotes_active = 1 ORDER BY RAND() LIMIT 1;"); | $quote_sql = $db->Execute("SELECT * from quotes WHERE quotes_active = 1 ORDER BY RAND() LIMIT 1;"); | ||
Line 30: | Line 33: | ||
</code> | </code> | ||
- | Obviously you should modify this to match your own template, and add whatever css would make it look good. | + | Obviously you should modify this to match your own template, and add whatever CSS would make it look good. |
+ | |||
+ | === Test it Out === | ||
+ | |||
+ | Add a few quotes into your database and test it out! | ||
+ | |||
+ | === Helper File === | ||
+ | |||
+ | You don't want to have to manually add quotes in the db through mysql every time, that would be a pain! Instead you should [[tariffhelper.html|make yourself a nice helper file]] in php that you can use through the zencart admin. | ||
+ | |||
+ | Here's an example of a simple file we use to make managing the quote a little easier: | ||
+ | |||
+ | {{:tutorials:zencartmods:quotes.php.zip|}} |