WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • General Help & Support »
  • Custom anynews htt template
  • Print
Pages: [1]   Go Down

Author Topic: Custom anynews htt template  (Read 8456 times)

Offline rumen

  • Posts: 480
  • Gender: Male
Custom anynews htt template
« on: July 06, 2022, 10:17:08 AM »
Hi there, I got issue with Anynews custom template (target is to make 3 responsible boxes horizontally with the last 3 news using the template classes)  - does not call it at all. Here is my code, if someone see where is the mistake please tell me:

Code: [Select]
<div class="anynews">
<section>
<div class="posts">
<article>
<h2>{TXT_HEADER}</h2>
<!-- BEGIN news_block -->
<a href="#" class="image"><img src={GROUP_IMAGE} alt="" /></a>
<h3>{TITLE}</h3>
<p>{CONTENT_SHORT}</p>
<!-- BEGIN readmore_link_block -->
<ul class="actions">
<li><a href={LINK} class="button">{TXT_READMORE}</a></li>
</ul>
<!-- END readmore_link_block -->
</article>
<!-- END news_block -->
</div>
</section>
</div>

Next issue - with all other standard  htt template I see the images as shape - but not the images itself - why doesn't show them? The images are in "media" folder. But when I open the image from the module the path is wrong. Where to point the right path? The module search the image in ../pages/ instead in ../media/
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Custom anynews htt template
« Reply #1 on: July 06, 2022, 07:58:02 PM »
{GROUP_IMAGE} is placeholder for Group image not post image.
Logged
Web developer

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Custom anynews htt template
« Reply #2 on: July 12, 2022, 09:17:23 AM »
For other members how this is done:

rumen already had image inside Short_content field, so here is the code (using cwsoft anynews)

Code: [Select]
$config = array(
    'group_id_type' => 'group_id',
    'group_id' => 5,
    'display_mode' => 11,
    '$max_news_length'    => -1,   
    'max_news_items' => 3,
'allowed_tags' => '<p><a>',
    'custom_placeholder' =>  array('IMG_LINK' => '%img%')
);
echo getNewsItems($config);

in include.php there are modifications:

Around line 229, replacement
Code: [Select]
                                // remove tags from short and long text if defined
       //                         $row['content_short'] = ($strip_tags) ? strip_tags($row['content_short'], $allowed_tags) : $row['content_short'];
        //                        $row['content_long'] = ($strip_tags) ? strip_tags($row['content_long'], $allowed_tags) : $row['content_long'];

                                // remove tags from short and long text if defined
                               $row_content_short = ($strip_tags) ? strip_tags($row['content_short'], $allowed_tags) : $row['content_short'];
                               $row_content_long = ($strip_tags) ? strip_tags($row['content_long'], $allowed_tags) : $row['content_long'];

/*
                                // shorten news text to defined news length (-1 for full text length)
                                if ($max_news_length != -1 && strlen($row['content_short']) > $max_news_length) {
                                        // truncate text if user asked for using CakePHP truncate function
                                        $row['content_short'] = truncate($row['content_short'], $max_news_length);
                                }
*/

                                // shorten news text to defined news length (-1 for full text length)
                                if ($max_news_length != -1 && strlen($row_content_short) > $max_news_length) {
                                        // truncate text if user asked for using CakePHP truncate function
                                        $row_content_short = truncate($row_content_short, $max_news_length);
                                }
also in line 282
Code: [Select]
          //                              'CONTENT_SHORT'      => $row['content_short'],
          //                              'CONTENT_LONG'       => $row['content_long'],

                                        'CONTENT_SHORT'      => $row_content_short,
                                        'CONTENT_LONG'       => $row_content_long,

To explain:
In call options:
'allowed_tags' => '<p><a>', , this means I removed <img> tag from short_content
also, using this:
'custom_placeholder' =>  array('IMG_LINK' => '%img%')   it extracted image from short_content so you can use it in template using {{ news.SHORT_IMG_LINK _1 }} placeholder

But I needed to duplicate short_content because it will strip img tag first, and then there is no img tag to be extracted.

I hope it will help to others.

Cheers
Logged
Web developer

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • General Help & Support »
  • Custom anynews htt template
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2