6 replies to this topic
#1
Posted 22 May 2012 - 09:11 AM
I have an area of content 'Upcoming Events' which has title, text, image etc.. I want to be able to make visible on a page and then sometimes remove it.
At the moment I can unpublish an 'Upcoming Events' page and that content is removed from the page where I display it, but i still have a bunch of empty HTML tags left over.
What is the best way to have an area of content turn 'off' without leaving any trace?
At the moment I can unpublish an 'Upcoming Events' page and that content is removed from the page where I display it, but i still have a bunch of empty HTML tags left over.
What is the best way to have an area of content turn 'off' without leaving any trace?
#2
Posted 22 May 2012 - 09:30 AM
Depends on how you code that part.
So I'd guess (without seeing your code) you have some echos in there that isn't conditional.
So I'd guess (without seeing your code) you have some echos in there that isn't conditional.
@somartist | modules created | support me, flattr my work flattr.com
#4
Posted 22 May 2012 - 07:46 PM
You could setup a checkbox field called "hidden" and only show it if it's unchecked.
<?php
$items = $pages->get("/page/")->find("hidden=0");
echo "<div><p>content</p></div>";
#5
Posted 23 May 2012 - 06:46 AM
Hi Soma, Ryan and Marty,
So i have a page using a template named 'upcoming-exhibitions' which contains all the content.
I want to display some of that content on it's parent page (exhibitions) where i want to be able to turn on and off… so to speak.
So on my exhibitions page I currently have this:
So i have a page using a template named 'upcoming-exhibitions' which contains all the content.
I want to display some of that content on it's parent page (exhibitions) where i want to be able to turn on and off… so to speak.
So on my exhibitions page I currently have this:
<?php
$item = $pages->get("template=upcoming-exhibitions");
echo "<h2>{$item->title}</h2>";
echo "<img src='{$item->exhibition_image->size(100,100)->url}' alt='$item->description'/>";
echo "<p>{$item->exhibition_summary}</p>";
?>
#6
Posted 23 May 2012 - 09:24 AM
put a checkbox on the main page template (it's more efficient since you don't even have to call the other page)
and do this:
Or, if you still prefer to have the checkbox on the exhibitions page:
and do this:
<?php
if($page->checkbox){
$item = $pages->get("template=upcoming-exhibitions");
echo "<h2>{$item->title}</h2>";
echo "<img src='{$item->exhibition_image->size(100,100)->url}' alt='$item->description'/>";
echo "<p>{$item->exhibition_summary}</p>";
}
?>
Or, if you still prefer to have the checkbox on the exhibitions page:
<?php
$item = $pages->get("template=upcoming-exhibitions");
if($item->checkbox){
echo "<h2>{$item->title}</h2>";
echo "<img src='{$item->exhibition_image->size(100,100)->url}' alt='$item->description'/>";
echo "<p>{$item->exhibition_summary}</p>";
}
?>
Also tagged with one or more of these keywords: solved
Community Support →
Getting Started →
Why does $page->rootParent identify current section?Started by isellsoap, 27 Feb 2013 |
|
|
||
Community Support →
General Support →
Change default operator for ProcessPageSearch?Started by bcartier, 20 Dec 2012 |
|
|
||
Solved
Community Support →
General Support →
$image->size(); configuration questionsStarted by 97s, 02 Dec 2012 |
|
|
||
solved
Community Support →
Multi-Language Support →
Setting translated titleStarted by thomas.isberg, 30 Nov 2012 |
|
|
||
solved
Community Support →
Multi-Language Support →
Multi-Language support broken in dev-branchStarted by interrobang, 19 Nov 2012 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













