Topic: Using document ID as URL prefix with Clean URLs : how ?  (Read 1486 times)

Pages: [1]   Go Down

#1: 28-May-2007, 06:07 AM

Marketing & Design Team

davidm
MODx evangelist
Posts: 7,073

The best way to predict the future is to invent it

WWW
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: 28-May-2007, 06:38 AM by davidm »
.: 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

#2: 28-May-2007, 09:12 AM

Foundation

rthrash
Posts: 11,344

WWW
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.
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#3: 28-May-2007, 09:29 AM

Marketing & Design Team

davidm
MODx evangelist
Posts: 7,073

The best way to predict the future is to invent it

WWW
It means that there is no practical mean to prepend the url with the ID without using CustomAlias ?
.: 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

#4: 28-May-2007, 09:33 AM

Foundation

rthrash
Posts: 11,344

WWW
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.
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#5: 28-May-2007, 09:37 AM

Marketing & Design Team

davidm
MODx evangelist
Posts: 7,073

The best way to predict the future is to invent it

WWW
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...
.: 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

#6: 28-May-2007, 09:40 AM

Foundation

rthrash
Posts: 11,344

WWW
Out of curiosity, why does the client want the Doc ID in every alias?
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#7: 28-May-2007, 09:50 AM

Marketing & Design Team

davidm
MODx evangelist
Posts: 7,073

The best way to predict the future is to invent it

WWW
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.
.: 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

#8: 28-May-2007, 09:56 AM

Foundation

rthrash
Posts: 11,344

WWW
I suppose that's a valid way to handle things. He will definitely need a custom plugin to address his requirement.
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#9: 28-May-2007, 10:07 AM

Marketing & Design Team

davidm
MODx evangelist
Posts: 7,073

The best way to predict the future is to invent it

WWW
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...
.: 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

#10: 29-May-2007, 01:53 AM

aspeum
Posts: 62

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: 29-May-2007, 01:57 AM by aspeum »

#11: 29-May-2007, 07:50 AM

Foundation

rthrash
Posts: 11,344

WWW
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.
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
Pages: [1]   Go Up
0 Members and 1 Guest are viewing this topic.