21285 Posts in 5732 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1495 Views |
-
Show children from another page

12 March 2010 at 6:06am
I have a web site: https://nutrition.canoncityschools.org/
and I want to show the "home" page children under my "menu" and "contact" page.I tried to do this, but it is not working.
<% if ChildrenOf(Home) %>
<ul id="SideBar2">
<% control ChildrenOf(Home) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the $Title Menu">$Title</a></li>
<% end_control %>
</ul>
<% end_if %>Can anybody point me in the right direction?
-
Re: Show children from another page

12 March 2010 at 10:43am
Hey. Marlie.
I think you may trying to use getDataObject MethodIF the another page got its own Page type. you probably could add the method in Page_Controller
public function ShowOtherPage(){
$filter='ClassName="YourPageClass"';
$records=DataObject::get('SiteTree',$filter,'');
Debug::show($records);
return $records;
}In tempalate page- >xx.ss
you could use
<% control ShowOtherPage %><% end_control %> to retrive the data.
-
Re: Show children from another page

13 March 2010 at 3:58am
Hi Marlie511,
I checked out your code and it works fine for me... So if you did a ?flush=1 and your homepage's url is definitely 'home' (it should be
) then you should be OK. You didn't by any chance uncheck the 'show in menu' checkbox for the homepages children? -
Re: Show children from another page

13 March 2010 at 6:57am
Martimiz,
I restarted my web server, and it worked.
BUT, it is showng a double navigation on home.
Check it out:
https://nutrition.canoncityschools.org/
I don't need a double navigation on home.
Do you know how I can just have it show up under MENU and CONTACT?Thanks so much!
-
Re: Show children from another page

14 March 2010 at 8:57am
Supposing you don't have a separate pagetype/template for the homepage, I guess you could do something like this:
<% if URLSegment != home %>
<% if ChildrenOf(home) %>
<ul id="SideBar2">
<% control ChildrenOf(home) %>
<li class="$LinkingMode">
<a href="$Link" title="Go to the $Title Menu">$Title</a>
</li>
<% end_control %>
</ul>
<% end_if %> -
Re: Show children from another page

18 March 2010 at 3:08am Last edited: 18 March 2010 3:09am
I tried inserting this into my page.ss and when I flush the page it brakes the site by giving it a a blank page.
Do you have any idea by either looking at the code below for the URLSegment or by looking at all the code in my page.ss file if there is something I am messed up?<div id="sidebar" >
<% if URLSegment != Home %>
<% if ChildrenOf(Home) %>
<ul id="SideNav">
<% control ChildrenOf(home) %>
<li class="$LinkingMode">
<a href="$Link" title="Go to the $Title Menu">$Title</a>
</li>
<% end_control %>
</ul>
<% end_if %>c
-----------------------------------------------------Here is all the (messy) code in my page.ss
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" lang="en">
<head>
<% base_tag %>
$MetaTags
</head><body class="typography">
<div id="wrap">
<div id="header">
<div class="clear">
</div>
<% include Navigation %>
</div>
<div id="content-wrap"><div id="sidebar" >
<% if URLSegment != Home %>
<% if ChildrenOf(Home) %>
<ul id="SideNav">
<% control ChildrenOf(home) %>
<li class="$LinkingMode">
<a href="$Link" title="Go to the $Title Menu">$Title</a>
</li>
<% end_control %>
</ul>
<% end_if %><% if InSection(x) %>
<div id="main">$Layout </div>
<% else %>
<div id="mainsub"> $Layout </div>
<div id="bulletin_right">
<% include bulletinboard %>
$Sidebar<% control Level(1) %>
<% if Title = Home %>
<% include bulletinboard1 %>
<% end_if %>
<% end_control %><% control Level(1) %>
<% if Title = Contact %>
<% include bulletinboard1 %>
<% end_if %>
<% end_control %><% control Level(1) %>
<% if Title = Menus %>
<% include bulletinboard2 %>
<% end_if %>
<% end_control %>
</div>
<% end_if %>
</div>
<div id="footer">
<div class="footer-left">
<% include Footer %>
</div>
</div>
</div>
</body>
</html>
| 1495 Views | ||
|
Page:
1
|
Go to Top |


