Jump to content


Photo

pagetitle will disappear after reloading page


  • Please log in to reply
5 replies to this topic

#1 vampke3

vampke3

    Etomite Forum Newbie

  • Member
  • 8 posts

Posted 04 April 2011 - 08:00 PM

This is weird: I am in the process of writing a snippet where I use the following lines of code inside a form:

$item = $etomite->documentObject['pagetitle'];
$out .= "<tr><td >
		<input type=\"hidden\" name=\"item\" value=\"$item\" />
...
when using uncached snippets, if I hit the submit button the result is as expected. If I go back to the original page, the $item value will be empty!
This will resolve after clearing the cache, but the problem keeps popping up again.

I use cached snippets it works fine but since this snippet uses some ajax and writes things to the db I am uncertain if I should be using it cached.

I do not understand this at all. Could anyone explain me this?
When should you be using cached and when uncached snippets exactly?

Edited by vampke3, 04 April 2011 - 08:01 PM.


#2 Cris D.

Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,106 posts

Posted 05 April 2011 - 09:40 AM

This is weird: I am in the process of writing a snippet where I use the following lines of code inside a form:

$item = $etomite->documentObject['pagetitle'];
$out .= "<tr><td >
        <input type=\"hidden\" name=\"item\" value=\"$item\" />
...
when using uncached snippets, if I hit the submit button the result is as expected. If I go back to the original page, the $item value will be empty!
This will resolve after clearing the cache, but the problem keeps popping up again.

I use cached snippets it works fine but since this snippet uses some ajax and writes things to the db I am uncertain if I should be using it cached.

I do not understand this at all. Could anyone explain me this?
When should you be using cached and when uncached snippets exactly?


Hi vampke,
see documentObject variables: http://www.etomite.c...dpost__p__51798 also there's a patch to resolve uncached snippets not evaluating.

As for using cached snippets... any snippet on a cached page will not be able to use documentObject variables because the the page is retreived from the cache file, not built from the database, so the variables usually used to create the page are not currently stored and therefore do not exist in the $etomite-> variable at that time and therefore not avaliable to snippets.

By default, cached and uncached snippets only get parsed to the level deep that the parser is set to (default is 5 I think), but when you get issues is when you start nesting pages and / or snippets. If you have this set-up and the default number of passes are not sufficient to evlaute all snippets (cached or uncached), that's when I'd use the recursive parser mod in the link above. This will recursively parse snippets until they all get evaluated, then move on to evaluating the cached snippets as usual.

My advice... (Oh I love handing out free advice :)
  • Only use cached pages for static content.
  • Only use cached snippets if they are simple and not nested.
  • Never use the $etomite->documentObject method when you can use the other document API's much more reliably
  • Add the mod above to make use nested uncached snippets are evaluated on cached or uncached pages to an unlimited depth
  • Use the "Configuration / Interface and editor settings / Debug Snippets" feature to see what is going on in your sniuppets and how they are evaluating (order and depth).


#3 vampke3

vampke3

    Etomite Forum Newbie

  • Member
  • 8 posts

Posted 05 April 2011 - 03:26 PM

Thanks for the answer chris, looks like interesting literature.
Before I dig into it in detail: when you say document api's , you mean these, right?
How do I get the current page's pagetitle with these? By using documentidentifier to get the current page's id?
How is this different (and better) than using documentObject?

#4 vampke3

vampke3

    Etomite Forum Newbie

  • Member
  • 8 posts

Posted 06 April 2011 - 07:21 AM

update: using document identifier with
getPageInfo($id, $active=1, $fields='pagetitle');
does the trick.
Still not entirely clear on caching though...

btw: is this forum (and etomite!) still active? seems like only chris is still alive and Ralph only checks in every now and then.
I sincerely hope eto will not die a silent death, I have been using it since 2004. :(
What about that new version that is coming up since 2006 or so? Ralph?

#5 Cris D.

Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,106 posts

Posted 07 April 2011 - 09:13 AM

I don't check in so much as have an RSS feed that shows when new forum posts happen and I get them with my Outlook email. Doesn't matter if no-one else checks in or uses it or not, there's still heaps of etomite sites out there. This question has been asked in the past and it always seems to come back to it's Etomite - it just works so there's not really need for site owners to visit unless something like a new pHP version or new browser issues or new technology that needs a new snippet to come back and visit. As long as Dean keeps paying the hosting fees for this site (he probably owns the hosting company by now anyway), I'm guessing that etomite will stay around.

#6 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 07 April 2011 - 01:16 PM

I have a browser tab opened to these forums 24/7/365 and check in several times throughout the day and evening... True, not much happening around here, but I keep an eye on things just the same...

The last official release of Etomite was May of 2008... Yeah, almost 3 years ago now... How time flies... Between work, medical issues, and the unexpected loss of my v1.2 repository, I haven't had a lot of time to invest into what will most likely end up as the last official release, from me at least, of the current code base...

One big issue that Etomite is running up against is that hosts are blocking the use of PHP's eval() function which is what makes Etomite such a powerful and versatile package... I have been working on an alternative in another code base I have been working on, also for several years, but haven't had a chance to experiment with that alternative in a working environment...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users