How to get the url_alias by programmation

Author Message

justin kazadi

Monday 22 June 2009 2:19:48 am

Hi,

i want to know how to get the url_alias of node by programmation? the equivalent to :

{$node.url_alias|ezurl()}

thanks in advance.

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Seb gaillard

Monday 22 June 2009 2:39:52 am

in a php file?

Yannick Komotir

Monday 22 June 2009 2:43:27 am

Hi,

you object duty be a eZContentObjectTreeNode so:

    myUrl = $myNode->urlAlias();
 

<|- Software Engineer @ eZ Publish developpers -|>
@ http://twitter.com/yannixk

justin kazadi

Monday 22 June 2009 2:43:54 am

Yes , in the php file (extension).

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Heath

Monday 22 June 2009 3:08:37 am

Hello Justin,

Yes indeed this is possible.

Working with and learning from the eZ PHP API can be complicated.

Study the eZ PHP API while creating your script [0,1]

Cheers,
Heath

[0] http://pubsvn.ez.no/doxygen/trunk/html/
[1] http://pubsvn.ez.no/doxygen/trunk/html/classeZContentObjectTreeNode.html

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

justin kazadi

Monday 22 June 2009 3:35:00 am

thanks everybody.

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Damien Pobel

Monday 22 June 2009 7:01:33 am

Hi,

in fact, it can be even easier, if you write something like

{$my_var.my_attribute}

in a template and if $my_var is a PHP object so you can always write

$my_var->attribute( 'my_attribute' );

in a PHP script. If $my_var is a hash, you have to write

$my_var['my_attribute'];

The list of available attributes in objects can be found in http://ez.no/doc/ez_publish/technical_manual/4_0/reference/objects

Cheers !

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

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 11:02:08
Script start
Timing: Jan 18 2025 11:02:08
Module start 'layout'
Timing: Jan 18 2025 11:02:08
Module start 'content'
Timing: Jan 18 2025 11:02:08
Module end 'content'
Timing: Jan 18 2025 11:02:08
Script end

Main resources:

Total runtime0.8653 sec
Peak memory usage4,096.0000 KB
Database Queries75

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 588.0469152.6406
Module start 'layout' 0.00730.0032 740.687539.4766
Module start 'content' 0.01040.8534 780.1641709.9453
Module end 'content' 0.86380.0014 1,490.109416.1250
Script end 0.8652  1,506.2344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4094160.0002
Check MTime0.00130.1520160.0001
Mysql Total
Database connection0.00200.226910.0020
Mysqli_queries0.787991.0539750.0105
Looping result0.00090.0999730.0000
Template Total0.825795.420.4129
Template load0.00170.199220.0009
Template processing0.824095.226820.4120
Template load and register function0.00010.012010.0001
states
state_id_array0.00140.163510.0014
state_identifier_array0.00110.126120.0005
Override
Cache load0.00150.1770420.0000
Sytem overhead
Fetch class attribute can translate value0.00100.116650.0002
Fetch class attribute name0.00230.2652110.0002
XML
Image XML parsing0.00210.237850.0004
class_abstraction
Instantiating content class attribute0.00000.0027130.0000
General
dbfile0.00580.6717350.0002
String conversion0.00000.000840.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 35
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs