If you have a support question or comment, click the Post New Topic link below.
Current Version: 3.5.3Sytist Manual | Sytist Articles 

Conditional Category & Section Layouts

 
Please log in or Create an account to post or reply to topics.
 
Lucas H.
94 posts
Thu Dec 13, 18
4:12 PM
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.
Tim - PicturesPro.com
11336 posts
admin
Fri Dec 14, 18
5:58 AM
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
Lucas H.
94 posts
Sat Dec 15, 18
4:50 AM
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.
Tim - PicturesPro.com
11336 posts
admin
Mon Dec 17, 18
4:12 AM
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
Lucas H.
94 posts
Mon Dec 17, 18
4:33 AM
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)
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 - 2019 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