Page 1 of 1

CustomContent variables not set

Posted: Wed Nov 29, 2006 7:38 pm
by cubitus
Hello,

I have a problem with the module customContent. Any help will be appreciate because I don't know what to do  :-\

So I run CMSMS with the latest version of customContent and FrontEndUsers. The cachable flag of all my pages is not set and a user is logged (module FrontEndUser). In my template I have the following code

...
{cms_module module=CustomContent}
#{$customcontent_loggedin}#
   
{content}

#{$customcontent_loggedin}#

...

The rendered page look like

## hello #9#

The first call to {$customcontent_loggedin} give an empty string. The second give the correct userid. It seams that calling {content} has a side effect and initialize {$customcontent_loggedin}. As the CustomContent's documentation explain calling {cms_module module=CustomContent} before {$customcontent_loggedin} should do the trick.


Why is the customcontent_loggedin only set after I call {content} , that's my question. Do you have any idea about this problem ?


Thanks in advance for any help you can give me  :)

Re: CustomContent variables not set

Posted: Sun Dec 03, 2006 9:59 am
by cubitus
Hi again,

I'm still in trouble. I spend a couple of hours trying to find a way, but it still doesn't work ! I really need some help.

Ok next is a description of what I've done :


* reinstall cmsms and the 2 concerned modules (FrontEndUsers, CustomContent),
* modify FrontEndUsers (see http://forum.cmsmadesimple.org/index.ph ... 109.0.html),
* create two users and one group in FrontEndUsers,
* disable the cache of the page
* disable the global cache (see http://forum.cmsmadesimple.org/index.ph ... 819.0.html)

and ...

... the variable $customcontent_loggedin has a value only after calling the tag {content}.  ???

Ok, weel, but in this case, how can we display the content only for logged user. The next code fragment would never gives the expected functionnality (display the content only for logged user):

{cms_module module=CustomContent}
{if $customcontent_loggedin}
  {content}
{else}
  You are not authorized to view this data
{/if}

Did anyone of this forum get the same problem ? If yes how did you solve it ?

Thanks in advance for your time and your help  :)


cubitus


PS: the code of the template used :

Code: Select all

<__html>
  <head>
    <title>Hello</title>
  </head>
  </__body>

    {cms_module module="FrontEndUsers"}
    {cms_module module="CustomContent"}
    <br/>
    
    loggedin = {$customcontent_loggedin}
    <br/>
    
    {content} 
    <br/>
    
    loggedin = {$customcontent_loggedin}
    <br />
  <__body>
</__html>

Re: CustomContent variables not set

Posted: Tue Dec 05, 2006 3:06 pm
by calguy1000
That's weird, I don't have this issue.  I've used CustomContent all over the place in my template (above, and below the {content} tag) and around multiple content blocks with no difficulty.

Strangeness.  I'll try to look into it, but gotta finish up NMS first.

Re: CustomContent variables not set

Posted: Wed Dec 06, 2006 7:51 pm
by cubitus
Thanks Calguy1000 for taking into consideration my problem  :)

My dev configuration : Xampp Lite (php 5.1.4, Apache 2.2.2(win32) running on XP SP2.
I've just exported it on my hosting server (linux, php 5.2.0, Apache 1.3.37 (Unix) ) and the same weird effect appears  :'(

I continue digging ...

Re: CustomContent variables not set

Posted: Wed Dec 06, 2006 9:18 pm
by calguy1000
I'll try to remember to work on it tonite

Re: CustomContent variables not set

Posted: Sun Dec 31, 2006 12:14 pm
by cubitus
Hello,

I've tried it with the new release of FrontEndUsers and CustomContent and the same effect is still here  ???

Ok, I've try a bit more :

* I'm not using FEU anymore ( no more tag {cms_module module="FrontEndUsers"} in my templates)
* Instead of using the variable customcontent_loggedin I'm now using customcontent_ip

So the template look like

Code: Select all

<__html>
  <head> ... </head>
  </__body>

    <br>
      {cms_module module=CustomContent}
      customcontent_ip  = {$customcontent_ip}
    </br>
    
    {content} 

  <__body>
</__html>
and the ip does appears only one time after I've clear the global cache from the admin panel. The second time I click on the site menu, the ip does not appear.

Strange, something to do with some caching ? For you info I've disabled the smarty caching by adding the following line (the second one) in the index.php

Code: Select all

$smarty = &$gCms->smarty;
$smarty->caching = false;
$smarty->params = $params;
Ok, to be correct with you I found a workaroud:

Setting the value of $config['debug'] (config.php) to true gives the expected results, but with a lot of debug info on the bottom of the page. This workaround is not viable.

I feel it has something to do with CustomContent and the cache.

Any help/idea ?

Thanks in advance and happy new year 2007 !

Re: CustomContent variables not set

Posted: Tue Jan 02, 2007 11:32 pm
by RobinH
Hi

I also have this problem with CustomContent variables not being available before the {content} tag in my template.

In order to prove this I inserted a {get_template_vars) before and after the {content} tag :-

{get_template_vars}
{content}
{get_template_vars}

The first {get_template_vars} does not show any CustomContent variables (unless I have previously cleared the cache in Global Settings). The second [get_template_vars} always shows the CustomContent variables.

I have disabled the cache on the page and I have tried disabling smarty caching by adding $smarty->caching = false; to the index.php as described above, but this does not work as the smarty caches are still occuring.

As Cubitus says this has to be a problem with caching. 

Calguy, you say you don't have this issue, so how are you avoiding this problem?  Do you have another way of disabling the smarty caching?


Many thanks in advance for any help you can provide.

Re: CustomContent variables not set

Posted: Thu Jan 04, 2007 11:21 pm
by RobinH
Hi

I have still got this same problem with CustomContent, which is preventing me from going live with my first cmsms site. 

I found the following post from Calguy1000, which states that there is a bug in template caching.

http://forum.cmsmadesimple.org/index.php/topic,8806.msg45108.html#msg45108

I don't want to use an SVN copy of CMS in a production environment and I can't wait for the next release.  Is there any sort of fix I can make to prevent this template caching problem?  I am using CMSMS version 1.0.2 and CustomContent 1.4.4.

Any help or further guidance would be much appreciated.

Re: CustomContent variables not set

Posted: Sun Jan 07, 2007 12:13 pm
by cubitus
Thank you RobinH for the link  :)

Re: CustomContent variables not set

Posted: Sun Jan 07, 2007 5:24 pm
by calguy1000
Check out this link:  This is how I fixed it.

http://trac.cmsmadesimple.org/cgi-bin/trac.cgi/changeset/3560