Page 1 of 2

Menu question: Redirecting to sub-element

Posted: Thu Feb 14, 2008 3:45 pm
by nils73
Hi everybody,

I got stuck with a really simple question regarding CMSMS: How can I redirect from a parent-page to a sub-page, when you click the parent-page in the menu? To be more precise, I have the followin menu-structure

1. HTML
1.1 Tags
1.2 Attributes

And if I click on HTML in the menu I would like to open "1.1 Tags". The only way I could do this was to assign a link which messed up when we switched from index.php?page= to mod-rewrite-urls or pretty-urls. Is there no better way to achieve this? Any ideas?

Regards,
Nils (stupid me, posted this one in the wrong place first)

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 14, 2008 3:58 pm
by Nullig
Why don't you just make "1. HTML" a section header, which just opens the submenu and is not clickable?

Nullig

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 14, 2008 4:11 pm
by Vin
You would need a custom menu like this:
http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Layout/Menu_Manager#header_link_to_child
Create a new menu template in menu manager, copy and paste this template, assign it as default (or add a parametre in your  tag in your template (in Content > Templates) which will specify the template you want to use (if you don't know what I mean, look in the online help of the menu module (the blue (?) at the top of the menu module)).

Then, set every page from which you want to redirect to its child as a section header (in dropdown which specifies the content type, when editing a page).

Hope I was clear.

[edit] Seems like this thing is discussed over and over again. Shouldn't this template be included with the core CMSMS? What do you think, Nullig?

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 14, 2008 4:45 pm
by nils73
I have never tried sections because ... erm ... well because I did not know what they are good for. Will give it a try though because in this case it might do the trick.

Thank you guys.

Nils

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 14, 2008 4:46 pm
by Nullig
Yes, I think it should be included. It seems like a commonly used feature.

Nullig

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 14, 2008 7:00 pm
by LeeUmm
Sorry for hijacking the thread, but I'd like the same type of thing.

To be clear I have the following page structure:

1. case studies
1.1 project 1
1.2 project 2
etc

I'd like it so when users click case studies, they get the latest child page.

I tried using the custom menu code above, but it just displayed the menu as normal, and when it came to the case studies link, it just displayed the link as "Case Studies"  I have case studies set as a section header.

Edit: To be clear, I don't want the sub menu to be displayed, I want the the latest child page's content to be displayed. So clicking "1. Case Studies" displays "1.2 Project 2" or whatever the latest/newest page is.

Re: Menu question: Redirecting to sub-element

Posted: Fri Feb 15, 2008 9:02 am
by nils73
Nullig wrote:
Yes, I think it should be included. It seems like a commonly used feature.
I kept wondering why I could link to a local file from a dropdown, but not to a local link from a dropdown. That would be nice to have in future versions of CMSMS.

Regards,
Nils

Re: Menu question: Redirecting to sub-element

Posted: Sat Feb 16, 2008 9:20 pm
by Vin
LeeUmm wrote: Sorry for hijacking the thread, but I'd like the same type of thing.

To be clear I have the following page structure:

1. case studies
1.1 project 1
1.2 project 2
etc

I'd like it so when users click case studies, they get the latest child page.

I tried using the custom menu code above, but it just displayed the menu as normal, and when it came to the case studies link, it just displayed the link as "Case Studies"  I have case studies set as a section header.

Edit: To be clear, I don't want the sub menu to be displayed, I want the the latest child page's content to be displayed. So clicking "1. Case Studies" displays "1.2 Project 2" or whatever the latest/newest page is.
Are you sure you have all parent links set to section headers? It may lead to problems.

To edit: Am I to take it that the newest page is the last page (last project) in the projects list?

Re: Menu question: Redirecting to sub-element

Posted: Tue Feb 19, 2008 2:09 pm
by Pierre M.
Hello,
LeeUmm wrote: I'd like it so when users click case studies, they get the latest child page.
What about hacking this :
http://wiki.cmsmadesimple.org/index.php ... ly_updated
"Just" filter more with the where clause to select only the "case studies" subhierarchy...

Pierre M.

Re: Menu question: Redirecting to sub-element

Posted: Wed Feb 20, 2008 5:55 am
by LeeUmm
Unfortunately no that won't do the trick. I'm not looking for a list of links to the content, I'm looking for the actual page itself to be displayed with all its content.

I don't have all the parent links set to section headers, as not all are. I do have the Case Studies page set to it though. And yes the newest page is the last page is the project list. I suppose I could rearrange them as they came in though.

In a perfect world, and I don't think CMS made simple can do this, I'd like Case Studies to act like a section and display the latest X amount of pages in that section. Kind of like a blog setup, except I don't need categories, author/date postings, comments etc. I just need a list of the actual content. Since I can't really get it to display a list of say, 5 articles with pagination, I'd take the newest one and then display the sub menu to let users navigate through them all.

I've tried the menu suggestion above on a clean install of cmsms and got it working pretty good, not sure why it won't work on my real live site. Even on the fresh install, not all parent links are set as section headers, just the one I did to test, and it worked fine.

If anybody has any suggestions as to what I'm trying to do, that would be great. If I could get a section to display the last X amount of pages with pagination, I think cmsms could take over as my full CMS I use to build client sites. I'm loving it so far, but for certain sites I build using this example, I'll have to keep using something else.

The reason I don't use the news module for this, is that it doesn't support clean URLs, and really all I need are a list of X amount of articles display the full content, not anything else like categories/author/dates etc.

Re: Menu question: Redirecting to sub-element

Posted: Wed Feb 20, 2008 7:34 pm
by Vin
Configuring the News to show pretty urls: http://forum.cmsmadesimple.org/index.php/topic,19375.msg96370.html#msg96370

[edit] There are two solutions. One is through hacking the News and adding lines to .htaccess, the second one is through fetching the News with static pages via field.

And you can configure News template not to show categories/author/dates or morelink... and if you use News for its original purpose, you can restrict the template so that "News" stuff is not used for a specific "Case studies" category (you can always use smarty:

Code: Select all

{if $entry->category != "theCategoryYouDontWantToUseTheStuffEnclosedInTheseIfs"}
TheStuffEnclosedInTheseIfs
{/if}
)

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 21, 2008 1:45 am
by LeeUmm
Thanks for the heads up on that. I had been searching a few weeks ago to see if the News module could work with clean URLs, but didn't think it was there yet.

I've implemented this fix for the news module I had installed on the site. Not perfect, as I believe category listings don't show up as clean URLs, and search results for news items are still the old non title URL. Not a big deal at all though.

For my case studies example, it seems a bit hackish. I think I'll wait for version 2.0 of cmsms because I know there is a blog module being built into the core installation. Hopefully this will handle what I'm after.

From a usability point of view, hacking the news module to do this doesn't seem like the best idea. I build sites for clients, and to explain to them to use the news module for certain areas of the site which aren't news, doesn't seem like the best idea. I need to keep things super simple for people with no tech knowledge.

I'd just love for version 2 to include a content type that acts like a section that will list the last X amount of pages to it, or for the blog module to be a little cleaner and offer this functionality.

Thanks for the heads up on everyting. I'll keep trying to use the first menu code example you listed and change the "Case Studies" page to a section title to hopefully link to the first child page. I did have it working on a fresh test install, just not my other live site.

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 21, 2008 4:40 pm
by Vin
LeeUmm wrote: From a usability point of view, hacking the news module to do this doesn't seem like the best idea. I build sites for clients, and to explain to them to use the news module for certain areas of the site which aren't news, doesn't seem like the best idea. I need to keep things super simple for people with no tech knowledge.
Well, if this is the problem... you can change the name and other descriptions of the News module. Navigate to modules/News/lang directory with your favourite editor, choose the file with your language, and change the descriptions to whatever you want. ($lang['news'] = 'News' to $lang['news'] = 'Case studies', for example  ;)).

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 21, 2008 5:02 pm
by LeeUmm
That's a good idea and I'll keep that in mind for specific websites, but it won't work in this case because the site does use the news module already for posting real news. I suppose I could rename it to something generic, but as I've mentioned, still seems a bit hackish. I was hoping for something more flexible so in cases where I had a few sections on the site setup like this. Also, to just have a user login to one area of the site to post all the content, instead of having to go to multiple areas would be more simple.

It's no huge deal for now, in this specific example I'll just create a landing page for case studies with a generic write up, then link to the other pages with a sub menu. I was just thinking long term flexibility as I know I create a lot of sites with this structure.

I'm sure a custom smarty tag could be written to achieve what I'm after, but being a designer before a programmer, I wouldn't have the skill to write a pagination setup for this.

Re: Menu question: Redirecting to sub-element

Posted: Thu Feb 21, 2008 9:42 pm
by Vin
Just thought of this issue as well, the "workaround" would be duplicating the News module and replacing the words "News" and "news" with the custom words in News module (respecting the uppercase and lowercase) in this new News' files, and then installing it as a separate module.

I know, hackish... but effective (and I don't see anything too ugly about it). Anyway, concerning the "hackishness" of renaming the descriptions, in 2.0 it is planned to have translations in database and easy access to language specifics in backend (I think), so I think it would become common "hacking"  :). Now you have to edit the file, but... is it such a pain  ???
LeeUmm wrote: Also, to just have a user login to one area of the site to post all the content, instead of having to go to multiple areas would be more simple.
Erm... what do you mean exactly? Restricting the user to only edit one page or post news? I think you can do that already...