Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Make loop in template system?
Old 08-24-2008, 06:56 AM Make loop in template system?
Skilled Talker

Posts: 71
Trades: 0
I made a simple template system. I'm in the process of making a forum-style script, that has categories within categories. I would like to call my static template file that will display all of the data. I can do this easily enough for one query, but I can't get it ordered with the category-within-category system.

That was probably jibberish, let me try to articulate:

My query is set up in this fashion:

PHP Code:
$sql mysql_query ("SELECT * FROM categories");
while (
$row mysql_fetch_array ($sql)) {
    echo 
$row['title'].'<br />';

    
$sql2 mysql_query ("SELECT * FROM categories2 WHERE cat_id='".$row['id']."'");
    while (
$row2 mysql_fetch_array ($sql2)) {
        echo 
$row2['title'].'<br />';
    }

Excuse the sloppy, that's just for an example. Now, that is how I want it to work. It displays the first category, then the sub-categories beneath, then the next main category...etc. Well, if I assign variables to these arrays and just pass them to my template, it displays, obviously, the main templates all in a list then all the sub categories under.

That still doesn't make any sense reading it, hopefully somebody knows what I want to do. I just need to retain the order in the above code through a static template file. Maybe by using variables to start/end loops, but I don't know how to do that.

Thanks!
CrazeDizzleD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Make loop in template system?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08238 seconds with 12 queries