Share » Forums » Setup & design » User IP in template.

User IP in template.

User IP in template.

Friday 17 February 2006 7:27:27 am - 10 replies

Author Message

Łukasz Serwatka

Tuesday 21 February 2006 12:15:15 pm

Hi Sander,

You can use this template operator:
http://ez.no/community/contribs/template_plugins/ezservervars

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Sander van den Akker

Tuesday 21 February 2006 12:40:41 pm

wow excellent support, an extension on the fly ;) I could have built this myself but I wondered if there were any preset template variables I didn't know of.

thank you!

eZ Publish certified developer
http://auth.ez.no/certification/verify/392313

john polo

Tuesday 21 February 2006 6:14:07 pm

this returns i as empty

since the operator works as $_SERVER ..i believe there is something wrong in the script..type on foreach and some others..

Łukasz Serwatka

Tuesday 21 February 2006 11:28:11 pm

@Sander: You are welcome ;) One note here, to avoid issues with view cache you will need to disable view cache for your template and use {cache-blocks} if you will not do it this all your users will see only one IP, as long as you clear view cache.

{set-block scope=root variable=cache_ttl}0{/set-block}

{def $server_vars=ezservervars()}

{$server_vars['REMOTE_ADDR']}

{cache-block}
//rest of your tpl code
{/cache-block}

@John: Works fine here. Do you have any errors? Did you clear the cache?
Have you tried this code in your template?

{def $server_vars=ezservervars()} 
 
{$server_vars|attribute( show,1 )}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

john polo

Wednesday 22 February 2006 5:41:44 am

Lukasz thanks for the answer,

see its not giving out any error nor nothing on the page..i cleared the page i put the blocks up..nothing appears..dunno why

Łukasz Serwatka

Wednesday 22 February 2006 5:47:33 am

@John: Did you enable the extension in admin interface? Which eZ publish version do you use?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

john polo

Wednesday 22 February 2006 5:51:35 am

yes extension is enabled and ticked.. i am using version 3.7.2

Łukasz Serwatka

Wednesday 22 February 2006 6:07:33 am

Follow this steps:

1. put ezservers dir in ezpublish/extension
2. enable extension in Setup->Extensions
3. Clear all cache
4. put in pagelayout

{def $server_vars=ezservervars()}

{$server_vars['REMOTE_ADDR']}

5. Check your page.

Works fine on eZ publish 3.7.2. Are you sure that you followed all steps correctly?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

john polo

Wednesday 22 February 2006 6:18:02 am

yes sir everything in order..i can give you my site on email or something if u want to take a look at it

john polo

Wednesday 22 February 2006 11:55:24 am

I fixed the problem with Siw's help..thank you guys..nice job Lukasz

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu