Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Menu in Content


Go to End


566 Views

Avatar
Tene

Community Member, 1 Post

26 September 2014 at 3:00am

Edited: 27/09/2014 4:12am

Hallo everyone. Maybe someone knows the solution:

I need to display a menu / part of existing menu in content (in Editor). I need to render the sublink 1,sublink 2,sublink 3
as menu links in my content , with the usuall menu states (active, hover, etc.) , in any custom place.

link1
---- sublink 1
---- sublink 2
---- sublink 3
link2
link3

I cant add this functionality in page.ss , bacause the structure/design of the page is not always the same, same as the position of the menu.
.A
image
text
menu,
B:
image
menu
image
text
menu

etc

Thanx in advance for any help.....:)

EDIT: /////////////////////////////////

1. I created myownnavi.ss , and uploaded in /themes/my_theme/templates/includes/ folder
for testing purposes, in the code of myownnavi.ss there is some text only

2.I added in /mysite/code/Page.php

into:
class Page_Controller extends ContentController {
////this code:
function Content() {
$replace = $this->Content;
return str_replace('$Showme', $this->Something(), $this->Content);
return $replace;
}
function Something() {
return $this->renderWith('myownnavi');

}

3. into content of one of the pages inserted $Showme , but ist doesnt work...nothing shown....Im on Silverstripe 3.1.6

Knows someone the solution??