Page 1 of 1

Show filebrowser to FEU and weird Smarty tags

Posted: Thu Nov 01, 2007 2:09 pm
by Mantlet
Hi all,

As a basic CMSMS user I'm trying to work some with FUE en customcontent. I'm running into some problems I can't get solved.

First off, when typing some CC tags in TinyMCE, some caracters get replaced. This is the case with for example the following tag:

Code: Select all

{if $ccuser->loggedin()}
This gets replaced by

Code: Select all

{if $ccuser->loggedin()}
Because I also want other users to work in this content area on other pages, I can't turn off Wysiwyg.

Secondly, I want to show logged in users a filebrowser with their own specific files. These get placed in the folder uploads/debiteuren/debiteurnummer/ where debiteurnummer is a variable number, which I also specify as a property for FEU. So I found this nice filebrowser that I included, but how do I put a tag in that file that makes the link correctly? It has the following string for the folderpath:

Code: Select all

Start Directory - To list the files contained within the current 
directory enter '.', otherwise enter the path to the directory 
you wish to list. The path must be relative to the current 
directory.
*/
$startdir = '.';
So when I alter that to the following, it displays that folder correctly

Code: Select all

$startdir = 'uploads/debiteuren/12000008/';
But how do I replace the number by a tag that includes the FEU attribute

Code: Select all

{$ccuser->property('debiteurnummer')}
Is it possible to call such a property from outside of a CMSMS app? The filebrowser used can be found here: http://www.evoluted.net/community/code/directorylisting.php

Re: Show filebrowser to FEU and weird Smarty tags

Posted: Thu Nov 01, 2007 6:18 pm
by calguy1000
I've noticed the problem with the -> tags in the wysiwyg editors before..... what I suggest you do is:

a) on the specifc page that you want the customcontent code, add something like this into the 'metadata' field on the options tab:
  {assign var='myspecialvar' value='1'}

b) in your page template, around the {content} area do something like:
    {if isset($myspecialvar) && $ccuser->loggedin()}
        ....
    {/if}
    {content}

Next, you can extract smarty variables in php with the get_template_vars() smarty method.
i.e: 

Code: Select all

global $gCms;
$smarty =& $gCms->GetSmarty();
$cc_user =& $smarty->get_template_vars('ccuser');

Re: Show filebrowser to FEU and weird Smarty tags

Posted: Thu Nov 15, 2007 7:36 pm
by Mantlet
Hi,

THNX for the var declare thing. It got me something else I was trying to think of, but not what I intended. At least, I don't see how I can use that metadata field to get the > in my WYSIWYG to actually be a >, instead of its translation. Maybe I don't get something, but I see this solution a lot of times to define whether a page is protected or not. That's what I used it for anyway.

But how can I make such a code work in a WYSIWYG like this:

Code: Select all

{$ccuser->property('debiteurnummer')}
I'd like to display some of those custom properties when someone is logged in.

Secondly, when I use the default 'change settings template'. When it submits, it actually blanks al the fields that are filled, except for the username. No errors, just the next time you check the values are blank.
I use:
CMSMS: 1.2
FEU: 1.3
CC: 1.4.9

I also got some other error on the lost password form, but that can be solved from the SVN once that goes online again.

Thanks again

Re: Show filebrowser to FEU and weird Smarty tags

Posted: Thu Nov 15, 2007 9:09 pm
by calguy1000
Wysiwyg editors don't like code.  If you're going to be editing code, and putting that code into content areas then I suggest you disable your wysiwyg (it can be done on a user basis).

However, as i've illustrated in previous threads..... it's possible to send variables from the page to the page template so that all of the logic goes in the page template.

i.e:  Set a variable called 'privatedata' in the metadata section on the admin tab when editing a page.

Code: Select all

{assign var='privatepage' value='1'}
Then in your page tempate:

Code: Select all

{if isset($privatepage) && $ccuser->loggedin()}
   {content}
{/if}
-----
Next..... you can use the $ccuser->property('blah') function to get a property value and then you can use that value however you want:

i.e: 

Code: Select all

<a href="somefilebrowser.php?dir=uploads/debiteuren/{$ccuser->property('debiteurnummer')}">
However you can't use the $ccuser-> stuff in a wysiwyg editor, because it doesn't understand codes like ->
so what you can do is:  put something like this into thee metadata section of the page:

Code: Select all

{capture assign='debiteurnummer'}{$ccuser->property('debiteurnummer')}{/capture}
and then you can do this in a wysiwyg content area (if you have to, and can't do it in the template)

Code: Select all

<a href="somefilebrowser.php?dir=uploads/debiteuren/{$debiteurnummer}">