help to get an Object in PHP script

Author Message

SathishKumar Subramanian

Friday 09 April 2004 1:58:01 am

Hi Everyone,

I want to get the current object and its attributes (also their values) using PHP script. Could any one guide me to get those details? Please help.

Thanks & regards,
Sathish

 

Alex Jones

Friday 09 April 2004 6:31:14 am

Sathish, what do you mean by the 'current object'? At this point you cannot embed PHP within eZ publish templates directly. Are you trying to develop an extension? More detail will help us provide some answers.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

SathishKumar Subramanian

Friday 09 April 2004 9:15:11 pm

Hi Alex,

Nice to hear to from you. My site contains some articles and URLs from where the article content was collected. Using the PHP codes of the ez system ( PHP codes in Kernel or in other modules) I need to get the published article (object) and its attributes.

So when the user clicks on the URL of the article I need to send the articles language, entered by, material or book name through the query string .

how can I get the currently published article's attributes using the PHP code ? I am already sending the IP location in the query string using the PHP codes.

Help me to get the details. Thanx in advance. :)

Sathish

Alex Jones

Monday 12 April 2004 6:20:20 am

I'm not quite sure I understand what you are tryign to do... Is your goal to get the data stored in an object's attributes, add those to a URL which is sent to a non-Ez publish script? If so, you should be able to do that using the <i>concat</i> functionality and the individual attributes of the object. To see all of the available attributes for an object try using <i>{$node|attribute(show)}</i> or <i>{$:item|attribute(show)}</i>. This should list out every bit of adata assigned to that object, including (I believe) language.

An example would be:

concat("http://www.SITE.com/SCRIPT.php?bookname=",$node.data_map.bookname,"&entered=",$node.data_map.entered)

Please note, this code would need tweaking as I did this off the top of my head.

Does this help, or am I walking down the wrong path?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

SathishKumar Subramanian

Monday 12 April 2004 10:18:16 am

Hi Alex,

Thanks for your suggestion to get the attributes of an object in ez template codings. My requirement is to get the object attributes from the ez php codings. I have created a php page and keeping the user details in a cookie.( like user IP, article name, status etc.)

I want to keep some more article attributes like language, author name, article posted by, entry date, source of the article etc inside the cookie. I need to get them inside the PHP page. How can I achieve it? I have tried a lot. But not succeeded. :-( .

Thanks & Regards,
Sathish

SathishKumar Subramanian

Wednesday 14 April 2004 8:14:52 am

Hi Alex,

Please go through http://ez.no/community/forum/setup_design/help_to_get_an_object_in_php_script . Björn suggested that we can get the attributes using the PHP script. I have tried that. But getting the object id is the problem. :( I am trying to get the object id.

Thanks & regards,
sathish

Alex Jones

Wednesday 14 April 2004 8:32:33 am

Can you post the content of your script (Stripped of sensitive login data of course)? This may help to track down the problem. It may be a matter of which files you are/are not including etc.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

SathishKumar Subramanian

Wednesday 14 April 2004 10:02:55 am

Hi ALex,

I typed the following code inside the PHP page,

<?php

include_once( 'lib/ezutils/classes/ezhttptool.php' );
include_once( "lib/ezdb/classes/ezdb.php" );
include_once("kernel/classes/ezcontentobject.php");

$co = & eZContentObject::fetch($objectid);
$datamap = & $co->atrribute('data_map');
$sometext = $datamap['resource_language']->content(); //resource_language is an attribute
echo $sometext;

?>

Thanks & Regards,
Sathish

Alex Jones

Thursday 15 April 2004 8:18:22 am

Hrrrm, I'm not quite sure what else to try. Sorry. Perhaps someone else can help out..?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

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