xoops forums

energazer

Just popping in
Posted on: 2013/12/18 22:23
energazer
energazer (Show more)
Just popping in
Posts: 8
Since: 2013/1/1 1
#1

For each page or the section the sidebar or blocks

Hello, forgive for bad English
For each page or the section the sidebar or blocks. How it can be done?
How to register function of a call of different templates for pages.
I tried the defacer module but it for some reason doesn't change a subject for pages though in a configuration of a site it is worth changing a daw a subject. How in general to use it? I set a page url, I choose for it a registration subject, but occurs nothing.
Help please, I broke all head, it is necessary for modules publisher, smartfaq, TDMDownloads. If not for each page then for sections (categories) to realize.

xoops 2.5.6
publisher v1

Bleekk

Theme Designer
Posted on: 2013/12/19 8:05
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 934
Since: 2002/12/14
#2

Re: For each page or the section the sidebar or blocks

sorry I do not understand your problem completely.
do you want to change the content of your block depending on publisher article?
is it a custom block or a system or module block?
what is the content of the block?

heyula

Theme Designer
Posted on: 2013/12/19 8:17
heyula
heyula (Show more)
Theme Designer
Posts: 471
Since: 2008/4/24
#3

Re: For each page or the section the sidebar or blocks

If you want to use a separate tpl for each model would

theme.html into Introduce the module into pages

sample :

<{if $smarty.server.PHP_SELF=='/index.php'}>
       <{
includeq file="$theme_name/home.html"}>
    <{/if}>
    
    <{if 
$xoops_dirname == "TDMDownloads"}>
          <{
includeq file="$theme_name/tdmfullstroy.html"}>
        <{/if}>
    
    <{if 
$xoops_dirname == "publisher"}>
          <{
includeq file="$theme_name/publishercontent.html"}>
        <{/if}>


sample :

Home :
http://kirpiproje.com/ = home.tpl

Publisher:
http://kirpiproje.com/modules/genel/ = publisher.tpl

Publisher Clone Menager :
http://kirpiproje.com/modules/menager/ = menager.tpl

Blog :
http://kirpiproje.com/modules/blog/ = blog.tpl

Bleekk

Theme Designer
Posted on: 2013/12/19 9:07
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 934
Since: 2002/12/14
#4

Re: For each page or the section the sidebar or blocks

Heyula explained it very nice but I would like to show you one example how to easily change images depending on publisher article
The image can be a image in the header(theme) or in a custom block

The url of all publisher articles looks like this
1. if url rewrite method is Path-info:
"modules/publisher/index.php/item.2/name-of-article.html"
2. if no rewrite method is on
"modules/publisher/item.php?itemid=2"

The imortant thing is that the smarty "$xoops_requesturi" always returns
"modules/publisher/item.php?itemid=2"
it doesn't matter if you have set the rewrite method or not

My idea is to name the image like the id of the article and then to load this image in the particular article
Example

1.jpg in itemid=1
5.jpg in itemid=5
24.jpg in itemid=24
....

the first thing to do is to get the id of the article
I will use the "$xoops_requesturi" smarty.
As I explained above it returns follwing
"modules/publisher/item.php?itemid=2"

What I need is the number behind the "="

first I need the position of "="
I will assign the position number to a smarty variable so I can use it later
<{assign var=pos value=$xoops_requesturi|strpos:"="}>

The var $pos now stored the position like 45

Now let's get the number after the "="
<{$xoops_requesturi|substr:$pos+1:10}>


You can now store the image (example: 22.jpg) in "your_theme/images" folder and use it like this
<img src="<{xoImgUrl}>images/<{$xoops_requesturi|substr:$pos+1:10}>.jpg" />



This is for sure not the best way, but I wanted to show you that you can do pretty much with smarties.

heyula

Theme Designer
Posted on: 2013/12/19 9:35
heyula
heyula (Show more)
Theme Designer
Posts: 471
Since: 2008/4/24
#5

Re: For each page or the section the sidebar or blocks

@Thanks Bleekk

publisher to pull the data from the module

The sample code:

<{php}>
include_once 
XOOPS_ROOT_PATH '/modules/tarifler/include/common.php';
$tarifler =& TariflerTarifler::getInstance();
$myts =& MyTextSanitizer::getInstance();
$itemsObj $tarifler->getHandler('item')->getItems($limit 14$start 0, array(_TARIFLER_STATUS_PUBLISHED), -1$sort 'datesub'$order='DESC'''true$criteria nulltrue);
$totalItems count($itemsObj);

global 
$items;
$items = array();
if (
$itemsObj) {
        for ( 
$i 0$i $totalItems$i++ ) {

            
$newItems['itemid']       = $itemsObj[$i]->itemid();
            
$newItems['title']        = $itemsObj[$i]->title();
            
$newItems['body']         = $itemsObj[$i]->body();
            
$newItems['votes']        = $itemsObj[$i]->votes();
            
$newItems['image']        = XOOPS_URL '/uploads/blank.gif';
            
$images $itemsObj[$i]->getImages();
            if (
is_object($images['main'])) {
                
$newItems['image'] = XOOPS_URL '/uploads/' $images['main']->getVar('image_name');
            }
        
$items[] = $newItems;
    }
}
<{/
php}>
       
        <
link rel="stylesheet" type="text/css" href="http://www.pratiktatlilar.org/themes/tatlitarifleri/homeslider/css/demo.css" />
        <
link rel="stylesheet" type="text/css" href="http://www.pratiktatlilar.org/themes/tatlitarifleri/homeslider/css/elastislide.css" />
        <
link rel="stylesheet" type="text/css" href="http://www.pratiktatlilar.org/themes/tatlitarifleri/homeslider/css/custom.css" />
        <
script src="http://www.pratiktatlilar.org/themes/tatlitarifleri/homeslider/js/modernizr.custom.17475.js"></script>
            <
div class="container demo-1">


            <
div class="main">
                <!-- 
Elastislide Carousel -->
                <
ul id="carousel" class="elastislide-list">
                 
            <{
php}>
        foreach ( 
$GLOBALS['items'] as $myrow )
        {
        
$GLOBALS['xoopsTpl']->assign('itemid'$myrow['itemid']);
        
$GLOBALS['xoopsTpl']->assign('title'$myrow['title']);
        
$GLOBALS['xoopsTpl']->assign('body'$myrow['body']);
        
$GLOBALS['xoopsTpl']->assign('votes'$myrow['votes']);
        
$GLOBALS['xoopsTpl']->assign('image'$myrow['image']);
<{/
php}>
    
                    <
li><a href="<{$xoops_url}>/modules/tarifler/item.php?itemid=<{$itemid}>"><img src="<{$image}>" width="160" height="270" title="<{$title}>" alt="<{$title}>" /></a></li>            
                    
                <{
php}>
        }
<{/
php}> 
        </
ul>
                <!-- 
End Elastislide Carousel -->

          </
div>
          </
div>

        <
script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
        <
script type="text/javascript" src="http://www.pratiktatlilar.org/themes/tatlitarifleri/homeslider/js/jquerypp.custom.js"></script>
        <
script type="text/javascript" src="http://www.pratiktatlilar.org/themes/tatlitarifleri/homeslider/js/jquery.elastislide.js"></script>
        <
script type="text/javascript">
            
            $( 
'#carousel' ).elastislide();
            
        </
script>



$itemsObj = $tarifler->getHandler('item')->getItems($limit = 14, $start = 0, array(_TARIFLER_STATUS_PUBLISHED), -1, $sort = 'datesub', $order='DESC', '', true, $criteria = null, true);

($limit = 14,.....15......20 as
array(_TARIFLER_STATUS_PUBLISHED), -1, $sort category selection =1-2-3 as

Sample Code : http://pratiktatlilar.org/themes/tatlitarifleri/homeslider.html

Resized Image


http://pratiktatlilar.org/

Bleekk

Theme Designer
Posted on: 2013/12/19 10:21
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 934
Since: 2002/12/14
#6

Re: For each page or the section the sidebar or blocks

thanks heyula.
I took the publisher module only as example for how to work with smarties.
You can do a lot of things with smarties without have to code php.

for blocks inside a certain module I would use a custom block, make it visible in this module and then work with module smarties. in the publisher module it would be "$itemid".

energazer

Just popping in
Posted on: 2013/12/19 23:17
energazer
energazer (Show more)
Just popping in
Posts: 8
Since: 2013/1/1 1
#7

Re: For each page or the section the sidebar or blocks

Bleekk, heyula,
Thanks for participation, but is necessary to me here that, for example:
the publisher module, in it category Italy, Turkey, France, City subcategories, hotels, etc. It is necessary for me that each category, had subcategories the blocks.
For example:
the category Italy to remove blocks - publisher modules - the cities, the resorts of Italy, smartfaq - questions across Italy, responses across Italy, the news module - news across Italy
the category Turkey to show blocks - smartfaq modules - questions across Turkey, responses across Turkey, the news module - news across Turkey