Page 1 of 2

Same Site-Alias

Posted: Wed May 09, 2007 11:30 am
by tingeltangeltill
Hi,

i have a main navigation with "trekking", "countries", "know-how", and so on. this main navigation is the first level in my navigation.

the second level below the main menu items "trekking" and "countries" have the same names --> the countries. For the better understanding:


TrekkingCountries
SwedenSweden
AustriaAustria
NepalNepal


I use the friendly URLS and it is very important for me, that i have the urls like this domain.com/trekking/sweden and domain.com/countries/sweden.
But as we know it is not possible to use the same site-alias. cmsms would do it like this: domain.com/trekking/sweden and domain.com/countries/sweden1.
but "sweden" isn't using the same hierarchy level. one is below "trekking" and the other is below "countries". so the uniqueness is given. it's for sure that you can't deal the same site-alias if it the documents have no parent. but if they have a parent than it should not be a problem!

cyberman meant that i could solve this with mod_rewrite, but i think it is a core "problem". what do you think?

hopefully you understand what i wanted to tell you ;D

regards till

btw i think this should be changed in a future version ;-)

Re: Same Site-Alias

Posted: Fri May 11, 2007 10:54 am
by tingeltangeltill
come on, somebody out there must have a clue  ???

Re: Same Site-Alias

Posted: Fri May 11, 2007 11:03 am
by RonnyK
Do the pages have the same content as well, or do you ONLY want the alias to be the same. If you want to have the pages available twice, under both "trekking" and "countries", you could make the second entry a content-type "Link" to the first page that holds the content.

Ronny

Re: Same Site-Alias

Posted: Fri May 11, 2007 4:29 pm
by tingeltangeltill
Hi Ronny,

no, it is always unique content. Hopefully I find a solution for that or I have perhaps to look for another CMS  :o  :'(
And I want to stay!

Re: Same Site-Alias

Posted: Fri May 11, 2007 4:38 pm
by calguy1000
I don't think this is a bug.  You are using CMS Made simple in a way that it's not intended to run.

You're also forgetting, that even if you're  using pretty urls, there is more than one way of building a url in CMS to view a certain page.  i.e:  I can still use:  http://www.domain.com/index.php?page=alias

The heirarchies in CMS Made Simple are not enforced.  It's possible to build any number of menus to view pages in any different style or order (you just need to know a bit of php and write your own menu builder module).  the heirarchy manager is just used to work with the way people usually do things.  To implement things the way you are mentioning here may impede on others abilities to do their navigation the way they want.

I think mod_rewrite is the proper solution for you.

Re: Same Site-Alias

Posted: Sat May 12, 2007 12:31 pm
by tingeltangeltill
calguy1000 wrote: I don't think this is a bug. 
i never used the word "bug", because i know it isn't one.
You are using CMS Made simple in a way that it's not intended to run.
i think that is the problem :-(
I think mod_rewrite is the proper solution for you.
hopefully i find an automatically solution, that would be to much handwork

Re: Same Site-Alias

Posted: Sat May 12, 2007 12:57 pm
by tsw
I read the alias generation code few days ago and it should create alias-2 if same alias is already taken (didnt test tho :)

Re: Same Site-Alias

Posted: Sat May 12, 2007 2:09 pm
by alby
tingeltangeltill wrote: no, it is always unique content. Hopefully I find a solution for that or I have perhaps to look for another CMS  :o  :'(
And I want to stay!
For unique page there is this solution also.

Alby

Re: Same Site-Alias

Posted: Sat May 12, 2007 3:03 pm
by tsw
sorry, it seems that this feature has been added just some time ago, it will be in 1.1 just tested with current svn

Re: Same Site-Alias

Posted: Sat May 12, 2007 3:16 pm
by RonnyK
If I read the topic correctly, was the question to have the same page-alias "sweden" and again "sweden" instead of "sweden1" for the second content-page (with different content). The last few replies seem to go about different alias-pages.

Ronny

Re: Same Site-Alias

Posted: Sat May 12, 2007 4:12 pm
by tsw
doh, wouldnt be the first time I read sloppily and answer wrong questions ;)

back to drawing table...

Re: Same Site-Alias

Posted: Sun May 13, 2007 8:56 am
by tingeltangeltill
RonnyK wrote: If I read the topic correctly, was the question to have the same page-alias "sweden" and again "sweden" instead of "sweden1" for the second content-page (with different content). The last few replies seem to go about different alias-pages.

Ronny
that's right

Code: Select all

I read the alias generation code few days ago and it should create alias-2 if same alias is already taken
jepp.... unfortunately.

In which document can I find the alias generation code? It must be possible to change that!?

thanks for your help

Re: Same Site-Alias

Posted: Sun May 13, 2007 9:00 am
by tsw
alias generation code is in lib/classes/class.contenttype.inc.php function SetAlias($alias)

and I have one idea for you.

use long aliases like parent-parent-parent-alias and write new rewrite rule that maps / to - character. this might work, but you need to make sure that no other character gets mungled to - (atm at least / does ;)

good luck, if you come up with some great plan let us know :)

Re: Same Site-Alias

Posted: Sun May 13, 2007 9:01 am
by tsw
sorry small typo there. its class.content.inc.php

Re: Same Site-Alias

Posted: Sun May 13, 2007 9:11 am
by tingeltangeltill
tsw wrote: alias generation code is in lib/classes/class.contenttype.inc.php function SetAlias($alias)

and I have one idea for you.

use long aliases like parent-parent-parent-alias and write new rewrite rule that maps / to - character. this might work, but you need to make sure that no other character gets mungled to - (atm at least / does ;)

oh, thanks for the fast answer. i should'n be so lazy. i also was able to find it by myself.

Code: Select all

$params = array($alias);
			$query = "SELECT * FROM ".cms_db_prefix()."content WHERE content_alias = ?";
			if ($content_id > -1)
			{
				$query .= " AND content_id != ?";
				$params[] = [b]$content_id[/b];
			}
			$row = &$db->GetRow($query, $params);

			if ($row)
			{
				$error = lang('aliasalreadyused');
			}
$content_id that is the thing. isn't it right, that i "just" have to change the thing, that one page alias can be added several times. the primary key in the cms_content must be changed, if there is one. am i am right?
good luck, if you come up with some great plan let us know :)
you are from the devteam, i am just a small user ;-)