Jump to content

Conditional IF ELSE on LISTING TEXT


n00bster

Recommended Posts

hi. i'm migrating from jreviews 2 to 3.

in v2 i had a IF ELSE condition for the description of listings. because some of my listings does not have a text. instead of no text i have setup a inquiry button that people might be add the missing description - a visuell reminder.
now i want to add this also in v3 but instead description i need the full TEXT (summary & description). in your documentation the "text" is set as this listing array:

https://docs.jreviews.com/?title=Variables_you_can_use_in_theme_files

<?php echo $listing['Listing']['text'];?>

i modified this code to my needs:

        <?php /* MODIFICATION of SUMMARY - DESCRIPTION */ ?>

        <div class="jrListingFulltext <?php echo $char_limit > 0 ? 'jr-show-more' : ''; ?>" <?php echo $char_limit > 0 ? 'data-characters="'. $char_limit .'"' : ''; ?> itemprop="description">

            <h3 class="jrFieldGroupTitle"><?php echo $listing['Listing']['title']?> Tourenbeschreibung</h3>

            <?php if ($listing['Listing']['text'] != ''): // if listing text exists ?>

                <?php echo $listing['Listing']['text'] !== strip_tags($listing['Listing']['text']) ? $listing['Listing']['text'] : nl2br($listing['Listing']['text']);?>

            <?php else: ?>
                <div class="jrFieldLabel">
                    <button class="jr-send-inquiry jrButton jrSmall" data-listing-id="<?php echo $listing['Listing']['listing_id'];?>">
                        <i class="fa fa-pencil fa-fw"></i><span>keine Tourenbeschreibung vorhanden - hilf mit!</span>
                    </button>
                </div>
            <?php endif;?>

        </div>

the problem is that this does not work with the TEXT array. when i change it to DESCRIPTION it does work as i want.
what do i wrong here?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...