Forums / Developer / How to get the url_alias by programmation

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