Template developer life saver: easyadmin updated

Author Message

Xavier Dutoit

Saturday 18 November 2006 1:27:47 am

Hi all,

As most of you when developping templates, I spend half of my time clearing cache and waiting on the page to load (the other half being filled with questions like: why on hell is that sooo slow).

I've updated easyadmin on pubsvn and there http://ez.no/community/contribs/import_export to add a new feature to clear the cache of only one node.

How is that going to make you feel better when modifying templates ?

When you change a template, you have to clear the cache and redisplay your page to see the result.

Dead slow, no fun.

Once you've added easyadmin as an extension, add (somewhere in your pagelayout, in the footer for instance)

{include uri="design:easyadmin/clear.tpl"}

Then you have a "Refresh this page" link. You clic on it, the page is redisplayed after having cleared the cache (of only the current node and keeps the others unharmed).

Tip to make it even easier: it has an accesskey of R, meaning that if you type alt+R it is going to redisplay your page taking into account the new templates.

Life is great again, tell to your one that you love her/him.

X+

http://www.sydesy.com

Bruce Morrison

Sunday 19 November 2006 8:39:39 pm

Hi Xavier

Car you aware of:

[TemplateSettings]
DevelopmentMode=enabled

Has made life much easier. It was backported to 3.6/7.

http://pubsvn.ez.no/nextgen/trunk/doc/features/3.8/template_development_mode.txt
http://lists.ez.no/pipermail/sdk-public/2006-February/001930.html

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Xavier Dutoit

Monday 20 November 2006 12:27:21 am

Hi,

Yes I was aware of it, but didn't know it was backported, thanks for the info

I've tried it on a 3.8, and it worked fine when compiling template, but didn't without compilation. Do you compile your templates during the dev ?

I find faster to turn it off , as :
1) the error/warning messages are usually more meaningful
2) it's faster to generate a page (the first time, but you don't have a lot of traffic on dev websites ;)

That's my setting:

[TemplateSettings]
ShowXHTMLCode=disabled
Debug=enabled
TemplateCompile=disabled
ShowUsedTemplates=enabled

You still benefit from the content cache (hence the need to clear the cache), but the pages are faster to generate the first time.

X+

http://www.sydesy.com

Xavier Serna

Wednesday 13 December 2006 1:54:05 am

Hi Xavier,

I find your contrib great, but, have you planned to port it to 3.8, or perhaps the new 3.9? Here we are all developing in 3.8, and tired of waiting 30+ seconds everytime we made a minor change in a tpl, as most of you, I suppose. :(

Thanks!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Xavier Dutoit

Wednesday 13 December 2006 2:20:27 am

Hi,

Have you tried on 3.8 ? Don't see any reason why it wouldn't work.

Could you report if something doesn't work ?

X+

http://www.sydesy.com

Xavier Serna

Wednesday 13 December 2006 3:19:38 am

Hi!

I've installed easyadmin in extension folder, and add the extension in the main override for site.ini but when I include

{include uri="design:easyadmin/clear.tpl"}

I get this message in the debug: No template could be loaded for "easyadmin/clear.tpl"

and nothing happens, obviously. I searched for clear.tpl in the extension files but there is no file with that name. Perhaps I've missed something? Or, is clear.tpl a template I have to create?

Thanks!

PS: with your settings in site.ini about the templates compilation and so on, the development is much much faster, thank you!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Xavier Dutoit

Wednesday 13 December 2006 3:36:31 am

Oops, didn't svn add it

if you use svn: svn update will make it.

If you don't, the easiest is to create
extension/easyadmin/design/standard/templates/easyadmin/clear.tpl

With :


{if is_set($module_result.node_id)}
<a href='/easyadmin/clear/{$module_result.node_id}' class='clear' accesskey='r'>Refresh this page</a>
{/if}

in it

http://www.sydesy.com

Xavier Serna

Wednesday 13 December 2006 7:14:32 am

Thanks for your reply Xavier, I've added the tpl and now I see the link to reload the page correcly, but when I click it I obtain a blank page, it seems that the module looses the current node viewed or something similar. I can see the main struct of the page, topcontent and so on, but with empty maincontent.

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Xavier Dutoit

Wednesday 13 December 2006 8:06:10 am

What's the url ? you see

The normal behaviour is to clear the cache, then goes back to the page (if I remember correctly using the referer).

Don't you have any special param to handle the referer or something ?

X+

http://www.sydesy.com

Xavier Serna

Wednesday 13 December 2006 9:05:15 am

For example, when I click the reload link from the home node (2) I get this url

http://myhost/easyadmin/clear/2

but didn't come back to the referer, so I have to use the back button from the browser. (FF 1.0.4 on a linux box, eZ 3.8.6)

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Xavier Dutoit

Wednesday 13 December 2006 11:22:48 am

Well, don't know why it doesn't come back. Could you have a look at

extension/easyadmin/modules/easyadmin/clear.php

echo $_SERVER["HTTP_REFERER"];

does it print something ?

X+

http://www.sydesy.com

Xavier Serna

Thursday 14 December 2006 12:26:41 am

Hi Xavier,

I believe that we found the problem. The file clear.php is also missing!
Can you post the content of the file so I can add it to the extension?

Thanks!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Xavier Dutoit

Thursday 14 December 2006 12:55:30 am

It indeed explains

I strongly suggest you to use svn if this isn't the case.
Otherwise, you can download the file from there:

http://pubsvn.ez.no/viewcvs/community/trunk/extension/easyadmin/modules/easyadmin/

http://www.sydesy.com

Xavier Serna

Thursday 14 December 2006 1:54:31 am

Many thanks Xavier.

Now I've start using svn with the ez repository. I've downloaded the latest version with all the files and it works quite correct!

Thanks for your support!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Paul Forsyth

Thursday 14 December 2006 2:04:38 am

Hi Xavier,

Just wondering if the code can be refactored a bit into separate classes which then allows for use as operators and so on?

Paul

Xavier Dutoit

Thursday 14 December 2006 7:37:38 am

Hi Paul,

Did you check the code ? that's about 5 lines and a half, not much to be refactored.

What was your idea/need about the operators ? don't get it.

X+

http://www.sydesy.com

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