Jul 05, 2009, 08:54 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Using document ID as URL prefix with Clean URLs : how ?  (Read 1118 times)
0 Members and 1 Guest are viewing this topic.
davidm
MODx evangelist
Marketing & Design Team
*
Posts: 7,026


Software is like sex, it's better when it's free !


WWW
« on: May 28, 2007, 06:07 AM »

Simple question really, and the custom alias plugin provides this feature but it has some other issues with stripping special characters out of URLs thus is not an option : How do I prepend the document's ID to my URLs ?

There is no built in TVs to add as prefix and of course [~[*id*]~] won't work...

Maybe a custom TV with an @EVAL ?

CustomAlias is using the following code to retrieve the id and add it to the url :

Code:
// Get the ID of the document, if you want to use it in your alias
$id = '.'.$modx->event->params['id'];

(.........)

 // Update the database
    $rows_affected = $modx->db->update(
      $fields,
      $table,
      "id = {$e->params['id']}"
    );
« Last Edit: May 28, 2007, 06:38 AM by davidm » Logged

.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #1 on: May 28, 2007, 09:12 AM »

096 doesn't have those issues with special characters and I suppose that you could take the same logic from the core now and update the custom alias plugin with that.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
davidm
MODx evangelist
Marketing & Design Team
*
Posts: 7,026


Software is like sex, it's better when it's free !


WWW
« Reply #2 on: May 28, 2007, 09:29 AM »

It means that there is no practical mean to prepend the url with the ID without using CustomAlias ?
Logged

.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #3 on: May 28, 2007, 09:33 AM »

I don't think so automatically. You could of course always go back to the doc after saving and insert [*id*]- to prepend the alias, but that seems like extra work to me. I'd personally update the custom alias plugin, since it's only introducing overhead when the document is saved and is otherwise out of the loop.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
davidm
MODx evangelist
Marketing & Design Team
*
Posts: 7,026


Software is like sex, it's better when it's free !


WWW
« Reply #4 on: May 28, 2007, 09:37 AM »

Ok thanks for the advice Ryan I'll try to go ahead with that if it's decided that we opt for this for the website I'd eventually need that feature...
Logged

.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #5 on: May 28, 2007, 09:40 AM »

Out of curiosity, why does the client want the Doc ID in every alias?
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
davidm
MODx evangelist
Marketing & Design Team
*
Posts: 7,026


Software is like sex, it's better when it's free !


WWW
« Reply #6 on: May 28, 2007, 09:50 AM »

That's what he has posted here on the french boards (in french).

He was afraid that if he changed title, the link to the resource would return a 404 page. I already explained to him before he posted that the alias was only updated if the alias field had no value, therefore changing the title would not change the alias. But that does not make sense to him to have an outdated alias : he wants it updated.

His idea (because a friend of his has a website with that feature -> I don't remember the url) is that  the ID should be prepended to the url in such a way that the alias has actually no real value to locate the resource : only the ID is taken into account by the system. For instance in his example 214-il-fait-beau-en-mai.html would return the same document as 214-whatever-alias.html does.
Logged

.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #7 on: May 28, 2007, 09:56 AM »

I suppose that's a valid way to handle things. He will definitely need a custom plugin to address his requirement.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
davidm
MODx evangelist
Marketing & Design Team
*
Posts: 7,026


Software is like sex, it's better when it's free !


WWW
« Reply #8 on: May 28, 2007, 10:07 AM »

Especially since this url scheme would mean handling 301 headers correctly since a document could have X aliases for one ID. And correct me if I am wrong but SEO Stricts URLs is not built to handle this kind of url patterns... that would mean building a plugin which would be a tweaked combo of CustomAlias and SEO Stricts URLs... tricky !

Plus, how much would that cost ?
I sure can't be the one to write the plugin...
Logged

.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
aspeum
Member
**
Posts: 62


« Reply #9 on: May 29, 2007, 01:53 AM »

Hi, I'm the client Cheesy

The website I showed to davidm was this one : http://www.abcdrduson.com (french rap magazine). And indeed, the only important part in the URLs is the id number.

Example :
http://www.abcdrduson.com/interviews/interview-102-grain-de-caf--octobre-rouge-.html (current URL)
http://www.abcdrduson.com/interviews/interview-102-whole-new-title-.html (fictionnal updated URL)

But davidm pointed out a good point by asking how often do you need to change an page title. My opinion on this topic is probably biased by the fact that I'm currently creating the website I'm working on, and not simply keeping it up to date. I'm testing lots of stuff - content-wise - and therefore constantly changing page titles. But once the website will be launched, I agree that it should not be the case anymore, so, I guess my problem isn't one, actually...

Anyway, thanks for helping, Ryan !
« Last Edit: May 29, 2007, 01:57 AM by aspeum » Logged
rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #10 on: May 29, 2007, 07:50 AM »

A similar request has been made previously about logging all alias changes in conjunction with the SEO Strict plugin, and then deciding how to handle publishing state changes and so on. It seems like a simple problem at first, but there's actually quite a bit of work involved including redirect headers, etc.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!