{{ /if }}
{{ /list_articles }}
{{ /local }}
the problem with this approach is that it looks first for 4 articles order="bypublishdate desc" and then it filters them to see which one they have topics, so if u have attach a topic the last article it will not display 4 but 3,
my questions is the following
how can i do constraints="OnFrontPage is on and no topics"
i mean to list the 4 last articles but not the ones that they have a topic attach to them.
something like : select * from tablename where field-name='no_topics' order by date,
or something like that.
i was experienced some problems with short smarty functions i was trying to display only the first 5 words for each article title,
it was working fine with English but not with greek,
anyway in order to overcome that problem i wrote a simple function
///////////////////////
if anyone has a similar problem this how is working:
you will create a file under /include/smarty/plugins/
so it will be native to smarty,
u will follow the name rules smarty has,
for instance this file will be named function.lenght_title.php
Unfortunately there is no option in Campsite to list articles that don't
have topics assigned. I created an issue for this feature here: http://dev.sourcefabric.org/browse/CS-2132
Thank you for your feedback on text truncate, we'll import this feature in
Campsite code.
> Hi guys,
>
> i have the following problem,
>
> i want to list all article but not the ones who have a topic attach to them
>
> i know if i want to list article u can do the following
>
>
>
> {{ list_articles name="articles" constraints="OnFrontPage is on"
> ignore_issue=true order="bypublishdate desc" }}
>
> i can change the constraint to different option
>
> if i want a topic i can use topic is topic_name:language
>
> no problem with that,
>
> i will be more specific,
>
> first i try this one:
>
> {{ local }}
> {{ set_section number="1" }}
> {{ list_articles name="articles" constraints="OnFrontPage is on"
> ignore_issue=true order="bypublishdate desc" }}
>
> {{ if $campsite->article->has_topics }}
>
> {{ else }}
>
> {{ if $campsite->current_list->index==1 or
> $campsite->current_list->index==2 or $campsite->current_list->index==3
> $campsite->current_list->index==4 }}
>
> <li><a href="{{ uri options="article template article.tpl" }}" title="{{
> $campsite->article->name }}">{{ $campsite->article->name }}</a></li>
> {{ /if }}
> {{ /if }}
> {{ /list_articles }}
> {{ /local }}
>
> then
> {{ local }}
> {{ set_section number="1" }}
> {{ list_articles name="articles" constraints="OnFrontPage is on"
> ignore_issue=true order="bypublishdate desc" length="4"}}
>
> {{ if $campsite->article->has_topics }}
> {{ else }}
>
>
> <li><a href="{{ uri options="article template article.tpl" }}" title="{{
> $campsite->article->name }}">{{ $campsite->article->name }}</a></li>
>
>
> {{ /if }}
> {{ /list_articles }}
> {{ /local }}
> the problem with this approach is that it looks first for 4 articles
> order="bypublishdate desc" and then it filters them to see which one they
> have topics, so if u have attach a topic the last article it will not
> display 4 but 3,
>
> my questions is the following
>
> how can i do constraints="OnFrontPage is on and no topics"
>
>
> i mean to list the 4 last articles but not the ones that they have a topic
> attach to them.
>
> something like : select * from tablename where field-name='no_topics' order
> by date,
>
> or something like that.
>
> i was experienced some problems with short smarty functions i was trying to
> display only the first 5 words for each article title,
>
> it was working fine with English but not with greek,
>
> anyway in order to overcome that problem i wrote a simple function
>
> ///////////////////////
> if anyone has a similar problem this how is working:
>
> you will create a file under /include/smarty/plugins/
> so it will be native to smarty,
> u will follow the name rules smarty has,
> for instance this file will be named function.lenght_title.php
>
>
> and if u wish to use it do the following:
>
> {{ length_title vbstring=$campsite->article->Lead_and_SMS limit_counter=12
> }}
>
> the second argument is the length of words u wish to allow.
>
>
>
> function smarty_function_length_title($params, &$smarty)
> {
> $value= trim($params['vbstring']);
>
> $array = explode(" ",$value);
>
> $int_value= trim($params['limit_counter']);
>
>
> $num = count($array);
>
>
> $count=0;
>
> for($i=0;$i<$num;$i++){
>
> $legth_title[$i] = $array[$i];
>
> if(strlen(utf8_decode($array[$i]))>1){
>
> $count=$count+1; }
> if($count>$int_value){
>
> break;
>
>
>
> }
>
>
>
> }
>
> $comma_separated = implode(" ", $legth_title);
>
> if($num>$count){$space="...";}
>
>
> $comma_separated= $comma_separated ."$space";
> return $comma_separated;
> }
>
>
>
>
>
>