Use id for url

Author Message

Sao Tavi

Friday 27 May 2011 7:28:40 am

Is it possible to use the object id for the url?

It is something like this: users should be able to add data that is no readable by other users. The problem is that it is very common for the users to add objects with the same name. So if 2 users will create some content called "content", the first user will see the url to content as "parent/content", the second one will see the url to it's content like "parent/content-2".

I would not like this to happen, and I can see 2 options:

1) use for object's url it's id, like parent/77 (where 77 is the object's id)

2) add to object's url the owner's id, like parent/content-88 (where 88 is the user's id)

 

Are these setups possible?

Gaetano Giunta

Friday 27 May 2011 8:38:52 am

I suppose you know you can use /content/view/full/$nodeid and that it would not suit your needs, correct? Because using these urls all content objects are created equal...

As for data that is not readable by other users: this is a problem of permissions, not of urls. Because if you do not use permissions to block access to a given node, it will show up both in search results and when using the /content/view/full/$nodeid url syntax

Principal Consultant International Business
Member of the Community Project Board

Marko Žmak

Friday 27 May 2011 8:57:25 am

Sao, just a note...

When there are two subitems with the same name under the same parent node, eZ automatically generates different URL's for them. In your example that would be:

  • /parent/content
  • /parent/content_1

And when you use $node.url_alias for this nodes you'll get this different urls.

Does this help?

P.S. Your second option won't work properly if the same user creates two contents with the same name.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sao Tavi

Friday 27 May 2011 10:29:13 am

Thank you for your replies.

Gaetano, yes, but how can I get that url? I mean... Using url instead of url_alias (in fetch ('content', 'list'..)) makes no difference. The documentation says that it depends "on a configuration setting", but that does not help much.

Marko, yes, you are right. So the user id part seems to be a wrong idea. So only the first option still stands.

Marko Žmak

Friday 27 May 2011 10:38:13 am

"

Thank you for your replies.

Gaetano, yes, but how can I get that url? I mean... Using url instead of url_alias (in fetch ('content', 'list'..)) makes no difference. The documentation says that it depends "on a configuration setting", but that does not help much.

Marko, yes, you are right. So the user id part seems to be a wrong idea. So only the first option still stands.

"

It's a little bit unclear what are you trying to do...

Why (and how) do you want to use url in fetch(content, list)?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sao Tavi

Friday 27 May 2011 10:45:45 am

Yes, sorry, I was ambiguous. So I have a new class that in it's template gets it's subitems with fetch(content, list). I should have said directly in class ezcontentobjecttreenode.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:16:44
Script start
Timing: Jan 18 2025 02:16:44
Module start 'layout'
Timing: Jan 18 2025 02:16:44
Module start 'content'
Timing: Jan 18 2025 02:16:45
Module end 'content'
Timing: Jan 18 2025 02:16:45
Script end

Main resources:

Total runtime0.7852 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.9063152.6094
Module start 'layout' 0.00680.0028 741.515639.4375
Module start 'content' 0.00960.7735 780.9531616.2266
Module end 'content' 0.78300.0021 1,397.179716.1953
Script end 0.7852  1,413.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4213160.0002
Check MTime0.00130.1706160.0001
Mysql Total
Database connection0.00060.073010.0006
Mysqli_queries0.710790.5061680.0105
Looping result0.00070.0903660.0000
Template Total0.752195.820.3760
Template load0.00210.262320.0010
Template processing0.750095.511720.3750
Template load and register function0.00020.020810.0002
states
state_id_array0.00060.070610.0006
state_identifier_array0.00100.129520.0005
Override
Cache load0.00180.2329380.0000
Sytem overhead
Fetch class attribute can translate value0.00070.083430.0002
Fetch class attribute name0.00220.284280.0003
XML
Image XML parsing0.00150.189630.0005
class_abstraction
Instantiating content class attribute0.00000.003290.0000
General
dbfile0.00140.1777240.0001
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs