To post a new support question, click the Post New Topic button below.
Current Version: 4.8.5 | Sytist Manual | Common  Issues | Feature Requests

Please log in or Create an account to post or reply to topics.
You will still receive notifications of replies to topics you are part of even if you do not subscribe to new topic emails.

Conditional Category & Section Layouts

133 posts
Thu Dec 13, 18 4:12 PM CST
Hello Tim,

I'd like to insert a condition in the Layouts based on if a PreviewText is empty or not.

I'm absolutely new to PHP, but I tried to code:

if (empty(listingPreviewText($page))) {
echo "PreviewText ist empty";
} else {
echo "PreviewText does containt Text";
}

but without success. The PreviewText is shown rather then being checked if empty or not. I'm not sure, if there is a way for conditional Layouts at all.

Another Question:

listingTitle($page)

does return the Title with link to page, but is there a way to just return the link only in order to create a Hyperlink with constant link text
Edited Thu Dec 13, 18 4:18 PM by Lucas H.
16,148 posts (admin)
Fri Dec 14, 18 5:58 AM CST
The preview text variable is page_snippet

So

if (!empty($page['page_snippet'])) {
echo $page['page_snippet'];
}
Tim Grissett, DIA - PicturesPro.com
My Email Address: info@picturespro.com
133 posts
Sat Dec 15, 18 4:50 AM CST
Wonderful - thanks a lot!

could you answer my 2nd Question, too, please? Is there a way to return the hyperlink of a page using a variable like $page['page_url']?

I'd like to code:

if (!empty($page['page_snippet'])) {
//Show Button with link only, if PreviewText is not empty, so do nothing
} else {
echo 'Read more...';
}

Result: "Read more" is shown below preview text only if there is one, which is fine, but there is no Hyperlink yet.

P.S.: Tim, is there a way to post HTML-Code? After saving the post, HTML-Code is removed
Edited Sat Dec 15, 18 4:54 AM by Lucas H.
16,148 posts (admin)
Mon Dec 17, 18 4:12 AM CST
If you want to display "read more" as a link after the preview text, this code will display the preview text with read more after it:

if (!empty($page['page_snippet'])) {
print $page['page_snippet']; print ' <a href="'.$setup['temp_url_folder'].'/'.$page['cat_folder'].'/'.$page['date_link'].'">Read More</a>';
}

The forum strips any HTML code posted. You have to replate < with & lt; (without the space betweem & and l) to get < to display and code not to be stripped in the forum.
Edited Mon Dec 17, 18 4:14 AM by Tim - PicturesPro.com
Tim Grissett, DIA - PicturesPro.com
My Email Address: info@picturespro.com
133 posts
Mon Dec 17, 18 4:33 AM CST
Thank you Tim, it works perfect!
(it was necessary to replace '.$setup['temp_url_folder'] with "https://mydomainname.com in order to get a functional Hyperlink)
5 total messages
Please log in or Create an account to post or reply to topics.
This post has been viewed 516 times
Category: Site Design
 
Loading more pages
Loading more pages

Sign up for email promotions.

Your information is safe with us and won't be shared.

Thank you for signing up!

 
©2003 - 2021 Grissett, LLC. All Rights Reserved.

By continuing to browse or by clicking Accept Cookies, you agree to the storing of cookies on your device necessary to provide you with the services available through our website.

    Accept   Privacy & Cookie Policy
Loading More Photos
Scroll To Top
Close Window
Loading
Close