3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2803 Views |
-
Page control using URLSegment

26 August 2009 at 5:14am Last edited: 26 August 2009 5:15am
In past, i using <% URLSegment = item %> to control display item with i18n enable.
In new 2.3.2 > , all page have unique URL and I cannot identify a page using URLSegment.All suggestion to fix this problem?
How can I identify home home-1 home-2 as same page in template?
Many Thank !!
-
Re: Page control using URLSegment

26 August 2009 at 10:13am
If you have different page types and you're trying to identify the page type (eg: HomePage extends Page [http://doc.silverstripe.com/doku.php?id=tutorial:1-building-a-basic-site#creating_a_new_page_type])
Then doing:
<% if Class = HomePage %>
...
<% end_if %>should do what you want.
-
Re: Page control using URLSegment

28 August 2009 at 3:02am
But how to handle same type?
I am in trouble after upgrade from 2.2.3 to 2.3.3.
-
Re: Page control using URLSegment

28 August 2009 at 9:11am
What do you mean by same 'type'?
What exactly are you trying to do?
If you want to identify a page type, then what i said in the last post is how to do it.
-
Re: Page control using URLSegment

30 August 2009 at 4:50am
Dear Pigeon,
In past, I am using following method the create a hot item menu.
I list target's children items identifed with URLSegment in i18n enironment.
But in 2.3.3 seem I can't using this method again.<% control Menu(1) %>
<% if URLSegment=xxx %>
<% end_if %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle</span></a></li>
<% if Children %>
<ul>
<% control Children %>
<li><a href="$Link" title="view page $Title" >$Title</a></li>
<% end_control %>
</ul>
<% end_if %>
</li>
<% end_control %> -
Re: Page control using URLSegment

30 August 2009 at 4:54am
I think may using create a new type to fix it. But I would like find another method without create new type of page. I have few sites using old method.
-
Re: Page control using URLSegment

30 August 2009 at 1:42pm
Sorry, i have been without internet for the past few days.
I'm not entirely sure what you are trying to do or why you are doing it. Using if URLSegment =xx is very bad because if the user changeds the URL in the CMS, your site will break.
There should be some other way for you to do what ever it is.
-
Re: Page control using URLSegment

30 August 2009 at 1:43pm
You could also consider to move the URLsegment control to the controller and let is return true if your URLsegment is home || home-1 || home-2, and then control that method in you template.
When you do this in Page.php it will be rendered in all child page classes..
| 2803 Views | ||
|
Page:
1
|
Go to Top |



