How do I create a subfolder...

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
karc2007
Forum Members
Forum Members
Posts: 32
Joined: Wed Jun 27, 2007 10:57 am

How do I create a subfolder...

Post by karc2007 »

Hi,

I posted this message before, but in the wrong forum - sorry for that. As I wrote already  I´m jsut a bit scared, that I have a big problem.

i have a problem with the structure of my site and I need to create subfolders for articles.

for example: http://mysite.com/politics/index.html

How can I create a page alias like this?

I tried putting: "/politics/index" into the alias-field. Well that doesnt work. It just been transformer to "politics-index.html"

So, whats the trick about it? Is is possible at all?

Im really scared at the moment.
thanks for any help,
Marc
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm
Location: Cambridge, UK

Re: How do I create a subfolder...

Post by Nick Smart »

Quick answer:

1. Create a page with an alias of "politics".

2. Create a page with an alias of "index" and set "politics" to be it's parent.

3. In config.php set:

Code: Select all

#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';

#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism?  This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = false;

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = true;
Your url will be www.domain.com/politics/index.html

Nick
karc2007
Forum Members
Forum Members
Posts: 32
Joined: Wed Jun 27, 2007 10:57 am

Re: How do I create a subfolder...

Post by karc2007 »

Thanks a lot! You are my hero.

This is a big step forward.

Now I have the problem, that my submenu is done like this.. i didnt do it myself

A page was created with this content:
{menu template='subnav' start_page='subnav'}

The page has no parent page.

All subcategories have to have "subnav" as parent to appear in the submenu.

Now, as a result of this technique every folder is created like this: /subnav/folder/page.html

Can I get rid of the "subnav" in some way?

Perhaps by htaccess?

Thanks for any help.
Last edited by karc2007 on Wed Aug 27, 2008 9:05 pm, edited 1 time in total.
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm
Location: Cambridge, UK

Re: How do I create a subfolder...

Post by Nick Smart »

I assume there is a page called "subnav"? So is that the parent of "politics"? Sounds like you've got a page hierarchy that's one level too deep.

Take a step back. Draw it out on a piece of paper. Then re-organise your pages - page order, which pages are parents of which children, etc. perhaps delete some unecessary pages. Then re-think your {menu} statement and what the start_page should be.

Nick
karc2007
Forum Members
Forum Members
Posts: 32
Joined: Wed Jun 27, 2007 10:57 am

Re: How do I create a subfolder...

Post by karc2007 »

Hi, thanks again. My problem is, that the whole sub-navigation is done with that sub-nav-technique. Without it, it doesn´t even appear.  The subnav just builts the whole submenu, it doesn´t appear in the menu itself - its hidden. Again - I don´t know exactly, what the guy did, who built this up.  I think he had a problem with configuring the submenu and biult a workaround.

Do I have to built in the submenu in a whole new way perhaps?

When this menu statement says: {menu template='subnav' start_page='subnav'}. Can I jsut put in: {menu template='subnav' start_page=''} or {menu template='subnav' start_page='/'} ? How has the "start_page" have to be set, to be the root?

Thanks for your help so far.
Last edited by karc2007 on Wed Aug 27, 2008 9:34 pm, edited 1 time in total.
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm
Location: Cambridge, UK

Re: How do I create a subfolder...

Post by Nick Smart »

Maybe he's done something with a rewrite rule if you look through your htaccess file.

Nick
karc2007
Forum Members
Forum Members
Posts: 32
Joined: Wed Jun 27, 2007 10:57 am

it doesn´t look like it was done in htaccess.

Post by karc2007 »

At least, i couldn´t find anything extraordinary. Most of the stuff in my htacess is for blocking spambots.
But I dont´have that much experience with htacess.

I think thats the parts, that do  the redirects, right? ???

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]


# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+).html$ index.php?page=$1 [QSA] 


The rest of the htaccess is just for spam bots.
And if it does help:
You can see my site here: http://indonesia-portal.de


As you may notice, all URLs are on the root level and I don´t want to keep it like this for ever. I think even with a /subnav/ (I will choose at least a better name for it, its better than the current state. (Oh my, so much 301 to do.)  :'(

Would be great, if you can give a hint, seeing my htacess, but even if not, thanks for trying.
Marc
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: How do I create a subfolder...

Post by Dr.CSS »

Is the subnav page or whatever it is set as not shown in menu? it should be...
karc2007
Forum Members
Forum Members
Posts: 32
Joined: Wed Jun 27, 2007 10:57 am

Re: How do I create a subfolder...

Post by karc2007 »

Yes. its set to "active", but also to  "not show" already.
User avatar
pawi
Forum Members
Forum Members
Posts: 15
Joined: Wed Jun 23, 2010 8:20 am

Re: How do I create a subfolder...

Post by pawi »

Hello,

i also posted this in the german forum,
( http://forum.cmsmadesimple.org/index.ph ... 412.0.html )
but would like to try my luck here as well as you have posted an excellent solution for pretty URLs that works great for me (thanks!)

The only problem I have right now is that I use html in my Menu-Titles which create the subfolder names in my URL. As I use a lot of soft hyphenation with ­ my URL-subfolders look like this

http://domain.com/DE/super-shy-cali-shy ... index.html

How can I get rid of the -shy-s or any other HTML that i will maybe use in my Menu titles?

Thank you in advance

*Pawi

//edit: ummm..... a SHY pullback.. i will edit my site-alias and everything is fine :))
Last edited by pawi on Thu Jul 08, 2010 10:01 am, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”