[SOLVED] Custom Page Option Fields?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
zark
Forum Members
Forum Members
Posts: 11
Joined: Wed Jun 25, 2008 3:44 am

[SOLVED] Custom Page Option Fields?

Post by zark »

Is it possible to add Page options that the Content editors can set when creating their new pages?
There will be several 'content editors' and I want them to be able to select an option that will place their preconfigured photo/name on the page.
This image location is displayed in the template and not as part of the editable page content.

I previously used numerous templates with alternative CSS attached, but on this occasion, the combinations of templates/content editors will be numerous/confusing.

I believe that I will need a UDT to read the 'page option' and display the relevant image.
it might be possible to add a smarty tag in each content area and read that in the template, however, this will require some ability of the content editors to actually do it and do it correctly. I would prefer the custom page option.. option.

I found some similar requests, but no subsequent posts/solutions. Does anybody have any suggestions?
Thanks
Last edited by zark on Wed Jun 25, 2008 10:00 am, edited 1 time in total.
cyberman

Re: Custom Page Option Fields?

Post by cyberman »

You can use the tag {last_modified_by}. You have only to insert something like this

Code: Select all

<img src="uploads/images/editors/{last_modified_by format='username'}.jpg" ... />
The tag outputs the username of the last editor. If there's a username.jpg for every editor available, it will display the editor picture ... that's all.

(... stands for the other img tag options 8))
zark
Forum Members
Forum Members
Posts: 11
Joined: Wed Jun 25, 2008 3:44 am

Re: Custom Page Option Fields?

Post by zark »

Good Thinking.. I don't think it will be viable in this situation though.

The image to be displayed is for the department manager (site section owner), they may have a couple of people editing their sections though, so I wouldn't want the 'sub editors' to have their images there. If I edit/fix up some pages on their behalf, this would also try to change the image.

I guess the only way this would be viable is if I created a log in based on pages to be edited, rather than by user and anyone who edited pages, would need to know what credentials to use for each page..  :(
cyberman

Re: Custom Page Option Fields?

Post by cyberman »

zark wrote: The image to be displayed is for the department manager (site section owner)
If the department manager owns a ful section and his picture should be everytime displayed I suggest to use a special template with his picture inside.
zark
Forum Members
Forum Members
Posts: 11
Joined: Wed Jun 25, 2008 3:44 am

Re: Custom Page Option Fields?

Post by zark »

Thanks cyberman.. I may end up doing that..

I have 4 distinct themed sections (Set up with different templates) and a dozen photo requirements, not to mention a default, no photo template, multiplied by the the 4 themed sections, that is a lot of templates for them to select between..
It seems a bit of a brute force soltion..

I was hoping to achieve something bit smarter like, 4 templates setup and a photo based on whatever was the selected option in the page options.

I think I might try educating them to include a smarty tag in the content and a write a UDT in the template to pick up the setting...
cyberman

Re: Custom Page Option Fields?

Post by cyberman »

There are many other options too :)

You can use a second content block like

Code: Select all

{content block='editor' oneline='true' wysiwyg='false'}
and use it with

Code: Select all

<img src="uploads/images/editors/{content block='editor' oneline='true' wysiwyg='false'}.jpg" ... />
in template.

On page creation you will see now a one line row without WYSIWYG. If you insert there CEO CEO.jpg will display. So the entry is undepending from owner or editor.
zark
Forum Members
Forum Members
Posts: 11
Joined: Wed Jun 25, 2008 3:44 am

Re: Custom Page Option Fields?

Post by zark »

;D
Thanks cyperman, that is perfect, much more gooderer..
{content block='editor' oneline='true' wysiwyg='false'}
So I just need to wrap this tag in a DIV and set the visibility to none in CSS.
Thanks muchly.

Solution for anyone else..
Entered at top of body in template: (The value to this is set on the page content editor)

Code: Select all

<div id="contentowner">
{content block='editor' oneline='true' wysiwyg='false'}
</div>
Entered at section where image is to appear:

Code: Select all

{capture assign='ownername'}{content block='editor' oneline='true' wysiwyg='false'}{/capture}
{ownerpicture  name=$ownername}
User Defined Type called ownerpicture: (make lowercase and only output if it is set)

Code: Select all

if ($params['name'] !=''){
echo "<div id="owner" style="background-image: url(images/path/img_".strtolower($params['name']).".jpg);"></div>";
}
Finally, some CSS: (hide the content tag information)

Code: Select all

#contentowner{
      display:none;
}
#owner img{
	border: 1px solid #296aa9;
}
Last edited by zark on Wed Jun 25, 2008 10:38 am, edited 1 time in total.
cyberman

Re: [SOLVED] Custom Page Option Fields?

Post by cyberman »

You make it more difficult than it needs - the one and only is the following in template

Code: Select all

{content block='contentowner' oneline='true' wysiwyg='false' assign='ownerpicture'}
{if $ownerpicture neq ''}
<div id="owner" style="background-image: url(images/path/img_{$ownerpicture|lower}.jpg)"></div>
{/if}
Nothing to capture, nothing to hide - it's Smarty ;).
zark
Forum Members
Forum Members
Posts: 11
Joined: Wed Jun 25, 2008 3:44 am

Re: [SOLVED] Custom Page Option Fields?

Post by zark »

cyberman wrote: You make it more difficult than it needs - the one and only is the following in template

Code: Select all

{content block='contentowner' oneline='true' wysiwyg='false' assign='ownerpicture'}
{if $ownerpicture neq ''}
<div id="owner" style="background-image: url(images/path/img_{$ownerpicture|lower}.jpg)"></div>
{/if}
Nothing to capture, nothing to hide - it's Smarty ;).
:) Aaah.. yes.. that works too.. Thanks for your help..
Post Reply

Return to “CMSMS Core”