[Nulled] » Nulled Warez Scripts » CMS (Site management systems) » DataLife Engine » DLE hacks » Expanding the functionality of the template engine
December 26 2022

Expanding the functionality of the template engine


A small addition to the template engine for displaying a list of short news.

The essence of the problem:
I ran into a problem here. It was necessary to display news on the site for different categories - different template.
Of course, there is a "Short news template" parameter in the category settings, but that would be fine, but what if the data needs to be output in the form of a list, a tile and a table. Of course, you can use the constructions [category...] and [aviable...] but when there are a lot of categories, it turns out sooo cumbersome and inconvenient. Especially when there are more than 100 categories on the site and new categories need to be added periodically.
Also do not forget about the system wrapper, which is added automatically before output:
<div id="dle-content">{content}</div>
If the content is displayed as a table, you can still adapt
#dle-content{display: table;}
.shortstory{display:table-row;}
But with the list:
<ul><li>...</li></ul>
It certainly won't work out.
I'm not saying that navigation will also need to be adapted to the above tags.


Solution:
The solution turned out to be quite simple, but incredibly convenient and multifunctional!
To design the desired list, only the shortstory.tpl template is used (or which one is selected for the category). No additional tags are needed in main.tpl.
Here is an example of a short news template:
[page-count=1]<h1>Some SEO description for the selected category</h1>[/page-count]
<table>
<thead>
<tr>
    <td>Photo</td>
<td>Description</td>
</tr>
</thead>
<tbody>
[list]
<tr>
    <td><img src="{image-1}"></td>
    <td>
        [full-link]{title}[/full-link]
        <div>{short-story limit="200"}</div>
    </td>
</tr>

</tbody>
</table>
{navigation}
As you can see, the tag has been added:
[list]...
Inside it is exactly the template of the short news, everything else is a direct wrapper. Also pay attention to the navigation tag. You can manually place it anywhere or give it an individual style. If the tag is not specified, it will be displayed at the bottom by default.


Installation:
Open File engine/modules/show.short.php
Find a string (this is a piece of string, for simplicity):
    if( strpos( $tpl->copy_template, "[xfvalue_"
Insert BEFORE it:
////////////////////////////////////////////////////////////////////////////////////////////////
if(preg_match( "#\\[list\\](.+?)\\[/list\\]#is", $tpl->copy_template, $list_tpl ) ){
        $global_tpl = $tpl->template;
        $tpl->template = $tpl->copy_template = $list_tpl[1];
    }else $global_tpl = '';
////////////////////////////////////////////////////////////////////////////////////////////////

Find a line:
            switch ( $config['news_navigation'] ) {
Insert BEFORE it:
////////////////////////////////////////////////////////////////////////////////////////////////
if( !$global_tpl )
////////////////////////////////////////////////////////////////////////////////////////////////

At the very bottom, find the code:
}
?>
insert BEFORE it:
////////////////////////////////////////////////////////////////////////////////////////////////
if( $global_tpl AND $news_found ){
$tpl->result['content'] = str_replace( $list_tpl[0], $tpl->result['content'], $global_tpl );
        if (stripos ( $tpl->result['content'], "[category=" ) !== false) $tpl->result['content'] = preg_replace_callback ( "#\\[(category)=(.+?)\\](.*?)\\[/category\\]#is", "check_category", $tpl->result['content'] );
        if (stripos ( $tpl->result['content'], "[not-category=" ) !== false) $tpl->result['content'] = preg_replace_callback ( "#\\[(not-category)=(.+?)\\](.*?)\\[/not-category\\]#is", "check_category", $tpl->result['content'] );
        if(stripos($global_tpl,"{navigation}")!==false) $tpl->result['content'] = str_replace( "{navigation}", $tpl->result['navi'], $tpl->result['content'] );
        else $tpl->result['content'] .= $tpl->result['navi'];
    }
////////////////////////////////////////////////////////////////////////////////////////////////

That's all.
If the [list] tag is not used in the short news template, then the engine works in standard mode.

DLE version: 10.0 and older




Information

Visitors who are in the group Guests they can't download files.
Log in to the site under your login and password or if you are a new user go through the process registrations on the website.

Comments:

This publication has no comments yet. You can be the first!

Information the publication:

Related News

14 December 2022
DLE Releases
DataLife Engine 10.6

The following changes were prepared and implemented: DataLife Engine 10.6 Retail & Nulled 1. Added support for

Read more
26 December 2022
DLE hacks
Publication in a certain

Publication in a certain category for a certain group

Read more
14 December 2022
DLE Releases
DataLife Engine v13.1

We present you a new version of our DataLife Engine v.13.1 NULLED script. In this release, you will see the

Read more
17 November 2022
VBulletin»,vbulletin Releases
vBulletin.Suite.v4.1.3.PH

CMS The content of comments in CMS is not displayed in IE7 or IE8 compatibility mode Database error when CMS is

Read more
14 December 2022
DLE templates
KinoBar for DLE 14.0

Carefully and professionally prepared KinoBar template for DLE 14.0 web studio Redissx design with original and

Read more

Information

Users of 🆅🅸🆂🅸🆃🅾🆁 are not allowed to comment this publication.

Site Search

Site Menu


☑ Websites Scripts

Calendar

«    November 2024    »
MonTueWedThuFriSatSun
 123
45678910
11121314151617
18192021222324
252627282930 

Advertisement

Survey on the website

Evaluate the work of the site
 

Statistics

  • +20 Total articles 6747
  • +15 Comments 4083
  • +31 Users : 5825