Subject: A Little Code Help Needed

Posted on: 18/06/12 03:56pm
By: samstone

I try to make Hit Counts only viewable by people who are in the "ViewHits" group. I put the following code in storytext.thtml, but the code shows up on page rather than getting executed.

PHP Formatted Code
{!!if SEC_inGroup('ViewHits') !!}
        {lang_views} {story_hits}
                {!endif}


What am I missing?

BTW, I am trying this on Geeklog 2.0beta.

Thanks!

Sam

Re: A Little Code Help Needed

Posted on: 18/06/12 08:27pm
By: Laugh

We do not yet allow php in our templates so it will not work.

One possible work around could be to install the Autotags plugin. The new version allows for php so you could create your own autotag and then place that in the template to do the same thing.This may not work though if the template variables are figured out before autotags are executed in a template (I cannot remember if they are)

Re: A Little Code Help Needed

Posted on: 18/06/12 08:33pm
By: samstone

Thanks for the explanation. It works on GLFusion, so I thought it would work here too.

I came back to try Geeklog 2.0 because I am crazy about the multiple topic feature. So far I am enjoying it, even though I am still getting adjusted.

Peace!

Sam

Re: A Little Code Help Needed

Posted on: 18/06/12 11:06pm
By: suprsidr

There should be an easy way for advanced users and theme designers to be allowed to use php where ever they want in templates(at their own risk).
a $_CONF option perhaps.

Personally I just hack the code on a site/site basis, but I always have to look back to remember how I did something in one place to the next - and upgrading those sites is a *censored*.

Re: A Little Code Help Needed

Posted on: 19/06/12 04:04am
By: Dirk

You can define your own template variables, which may be a workaround in some cases. See CUSTOM_templateSetVars() in system/lib-custom.php

In this case (displaying the number of hits for a story), it would require some reengineering, though. You would have to figure out yourself which story is currently being displayed since that information is not readily available in CUSTOM_templateSetVars.

bye, Dirk

Re: A Little Code Help Needed

Posted on: 19/06/12 09:25am
By: Laugh

THis is something we wanted to add to Geeklog 2.0.0 but ran out of time. Hopefully it will make it into the next version...

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=94190