Intechnic
Users Developers
Home / Forums / International Users / German Users / Weiteres Theme mit nur einem Teil des Datenbestandes / Topic Posts

In-Portal Forum

This is a place for users of In-Portal to ask questions, discuss various topics, and interact with other members of the In-Portal Community. Please report bugs through the Bugs Team (not the Forum). If you are interested in contributing or joining one of the many Teams for In-Portal, please check out the Contribute section of the website.
 

In-Portal Forum

Weiteres Theme mit nur einem Teil des Datenbestandes (10)


Posted: 01/20/2004 2:33:00 PM

Reply Quoted  


Meine Suchmaschine umfasst 330 Kategorien. Nun möchte ich ein weiteres Theme erstellen, in dem nur rund 10 dieser Kategorien angeboten werden (also nur ein Teil des Datenbestandes). Wie mache ich das?

Posted: 01/21/2004 9:04:00 AM

Reply Quoted  


I try it with my doubtful English abilities: :wink:

(%cat_num_links%)
Wie kann ich die Anzahl der Links in einer ausgewählten Kategorie ausgeben?
--> How do I get the number of links in a selected category?
for example : (%cat_num_links_cat=17%)

(%insert_new_links%)
Wie erhalte ich alle neuen Links aus ausgewählten Kategorien?
--> How do I get all new links (only) from selected categories?
for example: (%insert_new_links_cat=5,17,19,32,46%)

(%stats_links%)
Wie erhalte ich die Gesamtsumme aller Links aus ausgewählten Kategorien?
--> How do I get the number of all entries (only) from all selected categories?
for example: (%stats_links_cat=5,17,19,32,46%)

I use In-link Version 2.2.10.

<font size=-1>[ This Message was edited by: Manuel. on 2004-01-21 09:26 ]</font>

Posted: 01/21/2004 1:00:00 PM

Reply Quoted  


Hello Manuel,

Thanks for helping me with translation :wink:. I'll look into this in a few days and will post it here.

Thank you once again.


Posted: 02/06/2004 3:23:00 AM

Reply Quoted  


I need this information for a new project. When may I expect an answer?

Posted: 02/06/2004 5:07:00 PM

Reply Quoted  


Hello,

Sorry for delay, I was sure that already completed this.

First you'll need to patch your current "includes/templ_lib.php" file. Find "parse" funcation and replace it with this one.

//main parsing func
function parse($t_name,$visited=&quot;&quot
{
    global 
$t_cache$filedir$parse_email$email_body;
    
//check for recursion in templates
    
if(!$parse_email)
    {    
        if(
ereg(&quot;%$t_name%&quot;,$visited))
        {    
            echo &
quot;***Errorrecursion in branch $visitednode $t_nameAborting template.&quot;;
            return;
        }
        else
            
$visited.=&quot;%$t_name%&quot;;

        if(
$t_cache[$t_name] == &quot;&quot //check if cashed
            $t_cache
[$t_name]=template($t_name); //load if not cashed
        
        $t
=$t_cache[$t_name]; //get local copy of the cash speed 
    
}
    else
    {
        
$t=$email_body;
        
$parse_email=false;
    }


    
#main parsing loop
    
$t_len=strlen($t);
    
$o=&quot;&quot;; //output HTML &ampPHP
    //tags parse
    
for($i=0;$i&lt;$t_len;$i++)
    {    
#search for next special tag
        
$tagOpen=strpos($t,&quot;&lt;%&quot;,$i);
        
        if 
$tagOpen===false
        {    
#only HTML left
            
$o.=substr($t,$i);
            break;
        }
        else
        {    
//get end of tag
            $tagClose
=strpos($t,&quot;%&gt;&quot;,$tagOpen);
            
$tag=substr($t,$tagOpen+2,$tagClose-$tagOpen-2);
            
//add all HTML before
            $o
.=substr($t,$i,$tagOpen-$i);
            
//process tag
            
if($col_pos=strpos($tag,&quot;:&quot)
            {    
$vtag_name=substr($tag,0,$col_pos);
                
$vtag_value=substr($tag,$col_pos+1);
                
                switch(
$vtag_name)
                {
                    case &
quot;language&quot;:
                        global $
$vtag_value;
                        
$o.=$$vtag_value;
                        break;
                    case &
quot;include&quot;:
                        
$o.=parse(substr($tag,8),$visited);
                        break;
                    case &
quot;nav&quot;:
                        
$o.=nav($vtag_value);
                        break;
                    case &
quot;inl_language&quot;:
                        
$o.=inl_language($vtag_value);
                        break;
                    case &
quot;drop_lang&quot;:
                        
$o.=drop_lang($vtag_value);
                        break;
                    case &
quot;drop_theme&quot;:
                        
$o.=drop_theme($vtag_value);
                        break;
                    case &
quot;drop_results&quot;:
                        
$o.=drop_results($vtag_value);
                        break;
                    default:
                        if 
function_exists($vtag_name))
                            
$o.= $vtag_name($vtag_value);
                        elseif 
file_exists($filedir.&quot;mods/$vtag_name.mod&quot)
                        {
                             include_once(
$filedir.&quot;mods/$vtag_name.mod&quot;
                             
$func_name = &quot;runmod_$vtag_name&quot;;
                             if 
function_exists($func_name))
                                
$o.= $func_name($vtag_value);
                        }
                        elseif 
file_exists($filedir.&quot;mods/$vtag_name.mod.php&quot)
                        {
                             include_once(
$filedir.&quot;mods/$vtag_name.mod.php&quot;
                             
$func_name = &quot;runmod_$vtag_name&quot;;
                             if 
function_exists($func_name))
                                
$o.= $func_name($vtag_value);
                        }
                        break;
                }
            }
            elseif(
function_exists($tag))
                
$o.=$tag();
            elseif(
file_exists($filedir.&quot;mods/$tag.mod&quot)
            {    
                include_once(
$filedir . &quot;mods/$tag.mod&quot;
                
$func_name=&quot;runmod_$tag&quot;;
                if(
function_exists($func_name))
                    
$o.=$func_name();
            }
            elseif(
file_exists($filedir.&quot;mods/$tag.mod.php&quot)
            {    
                include_once(
$filedir . &quot;mods/$tag.mod.php&quot;
                
$func_name=&quot;runmod_$tag&quot;;
                if(
function_exists($func_name))
                    
$o.=$func_name();
            }
            else
                
$o.=$tag;
            
//move ptr
            $i
=$tagClose+1;
        }
    }
    return 
$o;
}




Then append function to the end of the same file.


function cat_num_links_cat($vtag null)
{
    global 
$conn$cat$cat_query$link_new;
    
    
$_new $link_new;
    
    
//Number of days links considered as NEW; comment this out to use default Admin setting
    $_new 
5
        
    
$_tags explode(&quot;|&quot;, $vtag);
        
    if (
$_tags[0] == &quot;new&quot || $_tags[1] == &quot;new&quot)    
    {
        
$cutoffdate mktime(0,0,0,date(&quot;m&quot,date(&quot;d&quot-$_new,date(&quot;Y&quot);
        
$_add_new = &quot; AND inl_links.link_date&gt;='&quot;.$cutoffdate.&quot;'&quot;;    
    
    }        
        
    if 
$_catIDs $_tags[0] &amp;&amp$_tags[0] != &quot;new&quot)?  $_tags[0] : $cat)
    {
        
$sql = &quot;SELECT COUNT(inl_links.link_idFROM inl_lc LEFT JOIN inl_links ON inl_lc.link_id=inl_links.link_id WHERE inl_links.link_vis='1' AND inl_lc.link_pend='0' AND inl_lc.cat_id IN (&quot;.$_catIDs.&quot &quot;.$_add_new;
        
        echo 
$sql;
            
        
$rs $conn-&gt;Execute($sql);
        
$ret $rs &amp;&amp; !$rs-&gt;EOF)? $rs-&gt;fields[0] : 0;
    }
        
    return 
$ret;
}




It would one tag for all three cases:
1. Counter of NEW links from 1, 3, 4 categories

&lt;%cat_num_links_cat:1,3,4|new%&gt;



2. Counter of NEW links from 1 (one category) categories

&lt;%cat_num_links_cat:1|new%&gt;



3. Counter of links from 1 (one category) categories

&lt;%cat_num_links_cat:1%&gt;

(same for multiple cats)

In case if you don't specify category/s then it will the current one you are in. This way you can simply put

&lt;%cat_num_links_cat:new%&gt;

to get number of NEW links in current category.

Please don't forget to backup your files prior to make any changes.

Thank you.


Posted: 02/08/2004 8:27:00 AM

Reply Quoted  


Thank you, it works :smile:

The third question was
"How do I get all new links (only) from selected categories?
for example: (%insert_new_links_cat=5,17,19,32,46%)"

Unfortunately I make much work for you, sorry... :wink:

Posted: 02/08/2004 2:47:00 PM

Reply Quoted  


Hello Manual,

Here is example for third scenario:

&lt;%cat_num_links_cat:5,17,19,32,46|new%&gt;



It will return new links from the listed categories

Thank you.


Posted: 02/08/2004 5:31:00 PM

Reply Quoted  


Sorry, this is for the number of new links from selected categories. --> cat_num_link. Thanks again for the answer for 2 of 3 questions. :smile:

But the third question was "insert_new_link", i want to display all new links from selected categories: "display all new links from category 1,3,10". The Content, not the number.

<font size=-1>[ This Message was edited by: Manuel. on 2004-02-08 17:33 ]</font>

Posted: 02/09/2004 10:18:00 AM

Reply Quoted  


Hello here it is,

Add this function end end of templ_lib.php file.


function cat_list_links_cat($vtag null)
{
    global 
$conn$cat$link_query$link_new$link_data;
    
    
$_new $link_new;

    
// Number of days links considered as NEW; comment this out to use default Admin setting
    $_new 
5
    
$tpl = &quot;list_links&quot;; // Specify template which will be parsed.
    
$limit 10// Limit links (comment out the line to print all)
    
    
$_add_limit $limit? &quotLIMIT 0, &quot;.$limit : &quot;&quot;;
    
    
$_tags explode(&quot;|&quot;, $vtag);
    if (
$_tags[0] == &quot;new&quot || $_tags[1] == &quot;new&quot)    
    {
        
$cutoffdate mktime(0,0,0,date(&quot;m&quot,date(&quot;d&quot-$_new,date(&quot;Y&quot);
        
$_add_new = &quot; AND inl_links.link_date&gt;='&quot;.$cutoffdate.&quot;'&quot;;    
    }        
        
    if 
$_catIDs $_tags[0] &amp;&amp$_tags[0] != &quot;new&quot)?  $_tags[0] : $cat)
    {
        
$sql $link_query.&quotWHERE inl_links.link_vis='1' AND inl_lc.link_pend='0' AND inl_lc.cat_id IN (&quot;.$_catIDs.&quot &quot;.$_add_new.&quotORDER BY inl_links.link_date DESC&quot;.$_add_limit;
        if 
$rs $conn-&gt;Execute($sql))
        {
            while 
$rs &amp;&amp; !$rs-&gt;EOF)
            {
                
$link_data $rs-&gt;fields;
                
$ret.= parse($tpl);    
                
$rs-&gt;MoveNext();                            
            }
        }
        
    }
        
    return 
$ret;
}




And call for this in your templates:

&lt;%cat_list_links_cat:1,3,10|new%&gt;



Thank you.


Posted: 02/09/2004 10:37:00 AM

Reply Quoted  


Thank you very much for your help, now all is perfect! :smile: