Forums / Developer / Get last visited node

Get last visited node

Author Message

Kévin S.

Friday 06 August 2010 3:17:27 am

Hello !
I have a form with an input that must be automatically filled when the page is loaded. To generate its value, I need to know the name of the node the user comes from.

Is it possible to get the previous node (the node which generated the page which called the current page) and how ?
Thank you !
___
Kévin

Romeo Antony

Friday 06 August 2010 5:51:45 am

Can you please explain more about it "I need to know the name of the node the user comes from. Is it possible to get the previous node (the node which generated the page which called the current page) and how ?"

Kévin S.

Friday 06 August 2010 6:02:44 am

Let's take an example : I am browsing my site. I'm currently viewing the page of the node named "A". Then, I click "submit" and I am redirected towards a form. The form has to know that I am coming from the "A" node, so it can auto-fill its input with "A"

In the form template, how can I do to get the previous node (in the example above, the previous node is the "A" node) ?.

Thiago Campos Viana

Friday 06 August 2010 7:18:54 am

You can create a cookie with this information when user is on node named "A" and then set the form input value reading and assigning cookie value to its value getting input element by id.

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Kévin S.

Friday 06 August 2010 7:48:07 am

A cookie could do it, you're right Thiago.

I'm actually looking for a way to do it within ez publish, if it exists.

Thiago Campos Viana

Friday 06 August 2010 10:02:30 am

You can create a template operator that sets and get a session value using ezhttptool: lib/ezutils/classes/ezhttptool.php

But it isn't as straightforward as using cookies.

Maybe {ezhttp( 'LastAccessesURI', 'session' )} could work, but you will need to fetch the node of the last access URI or something else, don't know, never tried.

Another way could be with $view_parameters, so you link your node b url as path_to_nodeB/(title)/NodeA Tiltle

Then in template you access node A name with {$view_parameters.title}

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Kévin S.

Friday 06 August 2010 3:00:20 pm

OK, thank you I will try that. I'll give you the feedback once it's done.

If anyone knows a simpler way to get the last visited node, I'm interested.

Kévin S.

Tuesday 10 August 2010 7:04:24 am

I've just finished using a HTTP GET parameter. Works like a charm, and does not need cookies or sessions.

I appended directly to the link URL the GET param (in the A node template) :

<a href={concat("bla/blabla/form?idselected=", $node.node_id)|ezurl}>my link</a>

Then in the form template, I used the ezhttp operator :

{if ezhttp_hasvariable( 'idselected', 'get' )}
    {def $idselected=ezhttp( 'idselected', 'get' )}
{/if}

Thank you for your help, Thiago !

___

Kévin

eZ debug

Timing: Jan 18 2025 00:06:02
Script start
Timing: Jan 18 2025 00:06:02
Module start 'content'
Timing: Jan 18 2025 00:06:03
Module end 'content'
Timing: Jan 18 2025 00:06:03
Script end

Main resources:

Total runtime1.1992 sec
Peak memory usage4,096.0000 KB
Database Queries211

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0102 587.6094180.8438
Module start 'content' 0.01021.0629 768.4531641.4766
Module end 'content' 1.07310.1260 1,409.9297341.0703
Script end 1.1991  1,751.0000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.3616210.0002
Check MTime0.00160.1366210.0001
Mysql Total
Database connection0.00090.071410.0009
Mysqli_queries1.117993.22492110.0053
Looping result0.00240.20322090.0000
Template Total1.165097.120.5825
Template load0.00190.156520.0009
Template processing1.163196.991220.5815
Template load and register function0.00030.025010.0003
states
state_id_array0.00110.089610.0011
state_identifier_array0.00220.183020.0011
Override
Cache load0.00160.1326420.0000
Sytem overhead
Fetch class attribute can translate value0.00100.085740.0003
Fetch class attribute name0.00140.1140100.0001
XML
Image XML parsing0.00140.113440.0003
class_abstraction
Instantiating content class attribute0.00000.0018110.0000
General
dbfile0.00220.1802330.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
12content/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/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 30
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs