Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 04:54:40 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
149621 Posts in 21098 Topics by 7537 Members
Latest Member: lotte2
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: show childpages and childpages of childs in the parentpage  (Read 505 times)
Craxx

Offline Offline

Posts: 102



« on: February 20, 2010, 02:06:06 PM »

Hy WB-Gurus:),

i have the following problem. I have a page called "Handbuch" below this page there are several topics an subtopics.



To print the complette Handbook (Handbuch) at once, it should be shown under Handbuch with all Topics and subtopics. For this i need some Code. I have tested the following code from a Thread:

<?php
if ($page_id) {
    $db = new database();   
    $q = $db->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE root_parent = '$page_id' ORDER BY page_id");
    while ($d = $q->fetchRow()) {
        $wb->page_id = $d['page_id'];
        page_content();
    }
} else {
    page_content();
}
?>

With this code i get the topics and subtopics, but not really right. The it is not one after another like we can see the topics on left side, i think it is after the ID. I also tested the Aggregator Modul, but there is only the possibility for only Parent and Child no childs from the childs:)

Please help me?

best regards and THX a lot:)
Craxx
Logged

Craxx;)
Monky
Development Team
*****
Offline Offline

Posts: 47



WWW
« Reply #1 on: February 21, 2010, 08:50:00 PM »

Hi, I am trying to help a bit.

1. Your line
Code:
if ($page_id) {
doesnt make sense. I guess you mean something like
Code:
if ($page_id == 42) {
2. Your Query does
Code:
ORDER BY page_id
so of course the result is ordered by page_id  wink
I threw a quick glance in the pages table of my page and I think the ordering you want is something like
Code:
ORDER BY parent, position
I'm not really sure though if this grants exactly the result you want. If might be easier (though uglier) to make several queries: one for each child of "Handbuch". You can then sort those queries by position.
Logged
Craxx

Offline Offline

Posts: 102



« Reply #2 on: February 22, 2010, 11:10:35 AM »

Hy Monky,

thx for answer. I tested with following code, but i changed id from your 42 to 23 because handbuch is 23 and i sort by page_trail because parent and position doesn´t work. With this code it works Smiley:

if ($page_id == 23) {
    $db = new database();  
    $q = $db->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE root_parent = '$page_id' ORDER BY page_trail");
    while ($d = $q->fetchRow()) {
        $wb->page_id = $d['page_id'];
        page_content();
    }
} else {
    page_content();
}


best regards
Craxx
« Last Edit: February 22, 2010, 08:27:03 PM by Craxx » Logged

Craxx;)
Argos
Moderator
**
Offline Offline

Posts: 2084


WWW
« Reply #3 on: March 22, 2010, 09:56:38 AM »

Sounds like a regular sitemap to me, starting at a certain page.

As a droplet:
http://www.websitebakers.com/pages/droplets/official-library/navigation/sitemapchild.php

As module:
http://www.websitebakers.com/pages/modules/listings/section-pages/sitemap.php
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!