Same Site-Alias

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
tingeltangeltill

Same Site-Alias

Post 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 ;-)
tingeltangeltill

Re: Same Site-Alias

Post by tingeltangeltill »

come on, somebody out there must have a clue  ???
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Same Site-Alias

Post 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
tingeltangeltill

Re: Same Site-Alias

Post 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!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Same Site-Alias

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
tingeltangeltill

Re: Same Site-Alias

Post 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
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Same Site-Alias

Post 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 :)
alby

Re: Same Site-Alias

Post 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
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Same Site-Alias

Post 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
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Same Site-Alias

Post 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
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Same Site-Alias

Post by tsw »

doh, wouldnt be the first time I read sloppily and answer wrong questions ;)

back to drawing table...
tingeltangeltill

Re: Same Site-Alias

Post 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
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Same Site-Alias

Post 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 :)
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Same Site-Alias

Post by tsw »

sorry small typo there. its class.content.inc.php
tingeltangeltill

Re: Same Site-Alias

Post 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 ;-)
Locked

Return to “CMSMS Core”