is it possible to browse by node id ?

Author Message

Marvix Marx

Friday 05 January 2007 8:51:13 am

Hi ...

Is there are any way to remove the /node_45/node_55/ to /45/55 when the site charset is utf8 ?

Thx in advanced

Marvix Marx

Saturday 06 January 2007 4:20:35 am

Any have any idea ?

Marvix Marx

Sunday 07 January 2007 3:48:44 pm

Grrhhh ...

My client saying .. " lol ... in wordpress u can select the nice url format, by id, date, title .. or all ... and ur ezp cann`t !! "

Who knows ? ^^

Kristof Coomans

Monday 08 January 2007 12:22:25 am

You can use the URL translation system to accomplish this, but currently you'll have to add those specific url's manually. Maybe you can automate it with a content/edit handler.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Marvix Marx

Monday 08 January 2007 9:19:39 am

Thx kris ..

But this be Long story such Mexican serials show ^^ ...

All what I need to remove the node from url .. why /node_455/node_25/ ,,, better if just the node id ...

Marvix Marx

Tuesday 09 January 2007 2:42:17 am

as you said ... "Maybe you can automate it with a content/edit handler"

can u give more info plz ?

kracker (the)

Tuesday 09 January 2007 3:06:28 am

Search for your own answers... at least a little. Put forth some effort :\
These solutions you seek will require a lot of learning, adapting and personal growth to attain.

<i>
http://serwatka.net/en/blog/ez_publish_3_8_new_custom_edit_handler
http://ez.no/content/advancedsearch?SearchText=eZ+publish+content+edit+handler&SubTreeArray[]=308&SearchPageLimit=5&sourceid=Mozilla-search
http://www.google.com/search?num=50&hl=en&lr=&safe=off&rls=org.mozilla%3Aen-US%3Aofficial&as_qdr=all&q=eZ+publish+%22content+edit+handler%22+site%3Aez.no&btnG=Search
</i>

eZ publish provides an advanced, refined, proven url and nice_url system.
No it is not that other application, yes it does work differently.
It can be configured to provide all the same functionality,
perhaps more all depending on your skill at using eZ.

There are many ways to support different kinds of functionality,
find one that works for you and avoid potential problem that
you can not solve or address yourself until you can cross those bridges.

A custom edit handler might be the answer.
An though I relate to the clients without respect
of details which solutions are found ...

I think that it is irrational to compare features of solutions
so broadly as the sole basis for choosing a web application solution.

I would still urge you to study and experiment more between each question and when you do write, please write in complete sentences with much more background information surrounding the topic as it related to your inquiry.

An in the end as if the rest wasn't going to far ( i'm really trying to help you long term ),
There are seemingly endless debates on the relevance of url string text in relation to
document contents in practical seo. The word I've heard around the eZ camp is ...
url is irrelevant, well only for shock value, to follow up with it's a negligible loss.

Still eZ publish provides for very nice human readable urls and I think that's
almost good enough for most needs.

The solution to this problem; take responsibility of the new functionality
you want to implement in your own eZ publish solution.

Implement something that works to meet your needs, build a basis
of understanding and then expand that understanding, by doing the work
to create that understanding. It is still a fairly common type of php application,
with some of the clearest/cleanest real world application
source code I have ever seen to date.

I remember simply reading, rereading and studying the source
code to adapt my ways to mirror those of eZ, learning to design
and dream inside of and using eZ publish in a separate way
from tradition small web applications.

eZ publish is eXtensible; not always quick to implement without experience.

I know you can do anything with eZ because it's not just eZ it's what you can do with it, even when that means more development to support your own unique needs.

I was like you once focusing on all the ways eZ publish seemed to lack, only to find later in time it was me that was lacking (ps eZ publish is not perfect...)

Please ease up with the abbreviated two line statements or partial questions to complex subjects.

respectfully,
//kracker
<i>the sound of an empty stomach ...</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Marvix Marx

Tuesday 09 January 2007 4:24:47 am

Thx kracker for ur long answer for nothing ... best u said is the link to the target ^^

Didn`t force u to answer me, and don`t be a broader for ur ezp experience, u didn`t learn it from 36 post like since 2006, and u over 500 ^^

I had do some search about what I want didn`t find good info about .. any way maybe ur right maybe not ... but ur to much aggressive.. sorry pal and thx u any way ^^

Marvix Marx

Tuesday 09 January 2007 6:26:05 am

I think there is misunderstanding here ...

Normally if the site not uft encoded, the urls will look like this :

http://site/index.php/site_design/folder_name/article_title

but if it utf .

http://site/index.php/site_design/node_(id)/node_(id)
http://site/index.php/site_design/node_42/node_558

what am wanna know if it possible to show it like this or not :
http://site/index.php/site_design/42/558

thats it, I think the "Custom Edit Handler" cann`t do it ,because its going after editing and publishing ... am I right or not ?

Kristof Coomans

Tuesday 09 January 2007 7:18:02 am

Hi Marvix

What language are you using on the site?

Modify settings/override/site.ini.append.php to disable URL translations, your URLs will be of the form content/view/full/[id] then.

[URLTranslator]
Translation=disabled

Resources:
http://ez.no/doc/ez_publish/technical_manual/3_8/concepts_and_basics/url_translation
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/configuration_files/site_ini/urltranslator/translation

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Marvix Marx

Tuesday 09 January 2007 8:48:28 am

didn`t try that yet ... its will be long url !

Here what am thinking about ..

In the ezcontentobject_tree in the DB there is "path_identification_string" , am trying to replace it on publishing with node id just...

after playing with edit/handler .. here is the code :

<?php
class CustomUrlHandler extends eZContentObjectEditHandler
{
    function fetchInput( &$http, &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
    {
    }
 
    function storeActionList()
    {
    }
 
    function publish( $contentObjectID, $contentObjectVersion )
    {
		  include_once( 'lib/ezutils/classes/ezoperationhandler.php' );

        // fetch object
		$object =& eZContentObject::fetch( $contentObjectID );

        // get content class object
        $contentClass =& $object->attribute('assigned_nodes');
 		$ParentNodeID = $contentClass[0]->ParentNodeID;
 		$NodeID = $contentClass[0]->NodeID;
		
		$contentClass[0]->PathIdentificationString = "$ParentNodeID/$NodeID";
		$PathIdentificationString =  $contentClass[0]->PathIdentificationString;		 

		
		echo $PathIdentificationString."<br>--------<br>";
		
		
		echo "###########<br><pre>";
		print_r ($contentClass);
		echo "</pre><hr>";
 
    }
}
?>

with echo cmd its seems replaced, but in the mysql debug still inserting it as "node_45/node_11" !!

from where its getting it, is there are query object .. or its getting it from the temp node ?

will be problem with replacing it ... how ?

the site will be Arabic, and Hebrew.

Thanks in advanced.

kracker (the)

Tuesday 09 January 2007 10:54:08 am

Oddly similar question, <i>http://ez.no/community/forum/setup_design/why_mylinks_to_nodes_appears_as_node_45_node_55_node_56</i>

<i>//kracker</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

kracker (the)

Tuesday 09 January 2007 11:05:21 am

# grep -R "node_'" /web/ez/doc/kernel/

 

/web/ez/doc/kernel/classes/ezcontentobjecttreenode.php:            $topLevelName = eZURLAlias::convertToAlias( $topLevelName, 'node_' . $topLevelNode->attribute( 'node_id' ) );
/web/ez/doc/kernel/classes/ezcontentobjecttreenode.php:            $nodeName = eZURLAlias::convertToAlias( $nodeName, 'node_' . $node->attribute( 'node_id' ) );
/web/ez/doc/kernel/classes/packagehandlers/ezcontentobject/ezcontentobjectpackagehandler.php:                            if ( strpos( $matchKey, 'node_' ) === 0 &&
/web/ez/doc/kernel/classes/packagehandlers/ezcontentobject/ezcontentobjectpackagehandler.php:                            if ( strpos( $matchKey, 'parent_node_' ) === 0 &&
/web/ez/doc/kernel/classes/packagehandlers/ezcontentobject/ezcontentobjectpackagehandler.php:                    if( strpos( $matchKey, 'node_' ) === 0 &&
/web/ez/doc/kernel/classes/packagehandlers/ezcontentobject/ezcontentobjectpackagehandler.php:                    if( strpos( $matchKey, 'parent_node_' ) === 0 &&

Reading the function containing this text string is telling ... still it's not the (or at least the only) location which might play a part in the current implementation... still worth a read of the function 'pathWithNames' in the above file.

//kracker
<i>!the infidel with an idea ...</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Claudia Kosny

Tuesday 09 January 2007 2:51:36 pm

Hi Marvix

The main problem with your code is that you do not store the changed data back to the database.
Fetch attributes from eZ objects using $object->attribute('attribute_name').
Set attributes using $object->setAttribute('attribute_name', $attributeValue).
Store the changed object in the database with $object->store().

Here is how I would try to change the path identifcation string of the nodes belonging to an object:

  function publish( $contentObjectID, $contentObjectVersion )
  {
     $object =& eZContentObject::fetch($contentObjectID);
     if(!is_object($object))
     {
       eZDebug::writeDebug('Could not fetch object with id "' . $contentObjectID . '"', 'MyNodeRenameHandler::publish()');
       return;
     }   
      
     //maybe add some checks here as we might not want to do this for all objects

      $objectName = $object->attribute('name');
      $assignedNodesArr = $object->attribute('assigned_nodes');

      foreach($assignedNodesArr as $assignedNode)
      {
        $newName = 'foo' . $objectName ;  //use any value you want here to create the new name
        $assignedNode->setName($newName);
        $assignedNode->updateSubTreePath(); //creates the new pathidentificationsting and stores it
        $assignedNode->sync();  //stores only if necessary
        eZDebug::writeDebug('Renamed node to "' . $newName . '", object name is "' . $objectName . '"', 'MyNodeRenameHandler::publish');
      }
  }

It does the job roughly the same way eZ does it with the exception that you can give your own name to the node which is used in the pathidentificationstring.

There is at least one major problem: If you somehow connect this code to the publishing operation (be it with the custom edit handler or a content publish after workflow), this will not be triggered when you give an object an additional location.

Please be aware that I do not have the slightest clue whether changing the pathidentificationstring will mess EZ up or not!!

Good luck

Claudia

Marvix Marx

Tuesday 09 January 2007 2:56:19 pm

hmmm... I think its hopeless case unless do some modification in the kernel !

kracker (the)

Tuesday 09 January 2007 3:33:43 pm

<i>Still .....</i>

with this mindset hacking the kernel is hardly the problem. why stop you've gotten further than most do publicly on the subject, the goal is in sight +/- some bug fixes and refinement ... go for it!

Just keep copies of the original file before you modify a file, store
name variations of each file in a directory structure to hold,
modified or patched files for future re installation using
patches built from them. here is an example you'll find used a lot.

extension/example_com/
extension/example_com/patch/3.8
extension/example_com/patch/3.9
extension/example_com/patch/3.9/kernel/common/classes

This provides for upgrading eZ publish and adding back those custom modifications in a mostly automated way...

This is an eZ publish kernel hacker practice, heck it's a software development practice and it works, especially when you just got to have all those features without the wait.

Diff/patch command makes the whole process bearable to a point. eZpedia has a stub on the subject ...
<i>http://ezpedia.org/wiki/en/ez/patch</i>

<i>//kracker
MTV2 : Rob and Big</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Marvix Marx

Wednesday 10 January 2007 3:38:57 am

nice idea .. But I am not a php guru ^^

Kristof Coomans

Wednesday 10 January 2007 3:49:18 am

Great tip ( http://ez.no/community/forum/install_configuration/is_it_possible_to_browse_by_node_id#msg117236 ) kracker!

At first sight the code in ezcontentobjectpackagehandler doesn't seem to have anything to do with the url aliases.

If you replace the second argument of each call to eZURLAlias::convertToAlias with $node->attribute( 'node_id' ), instead of

'node_' . $node->attribute( 'node_id' )

then I think you have what you were looking for Marvix ;-)

Slightly related to your post about the url alias datatype: you could hack the code and add an "url alias name pattern" in addition to the "object name pattern" on content class level, and then use that pattern to create the url alias name and use that name as the first argument to eZURLAlias::convertToAlias.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Marvix Marx

Wednesday 10 January 2007 11:28:08 am

This will be my last step be for data entry, I will try to create datatype "Url Alias" which will be called from eZURLAlias, normal text input with fix UrlAlias identifier.

Kristof Coomans

Thursday 18 January 2007 4:44:50 am

I've send a patch to Marvix, which adds a second name pattern to the content class, which is used for the url alias of the objects. So the object name and the node url alias can be different now. Ideal for multilingual sites with chars not allowed in URL's.

In my limited testings it worked good, but I didn't get a response from Marvix so far.

If there are some people interested to test the patch then I'll post it to the contributions.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

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