TinyPortal

Development => Support => Topic started by: ElShotte on September 11, 2008, 12:22:41 AM

Title: Category List
Post by: ElShotte on September 11, 2008, 12:22:41 AM
Hey guys, I want my users to be able to click an "Articles" link in the top menu, which would take them to a page listing all the categories available. I am using SMF 1.1.6 and TP 0.9.8. Thanks.
Title: Re: Category List
Post by: Ken. on September 11, 2008, 01:20:17 AM
For that you would need to build a page and add your link for it to your theme.
There is an articlebox available in your TinyPortal admin panel, take a look at it to see if it will give you what you need.
Title: Re: Category List
Post by: ElShotte on September 11, 2008, 02:18:39 AM
Cool, would you be able to tell me which PHP file defines the look of the articles?
Title: Re: Category List
Post by: IchBin on September 11, 2008, 02:23:04 AM
TPortal.template.php
Title: Re: Category List
Post by: ElShotte on September 11, 2008, 02:28:37 AM
Thanks man.
Title: Re: Category List
Post by: ElShotte on September 11, 2008, 02:33:21 PM
Okay, now I need serious help. When you search, it searches through the forums only, I need to make a search box that will search through all the categories and articles. Is this feature built-in or do I have to code it myself?
Title: Re: Category List
Post by: JPDeni on September 11, 2008, 04:00:18 PM
There is currently no search function on the articles.
Title: Re: Category List
Post by: ElShotte on September 13, 2008, 06:32:04 AM
Any clue why I am not getting the message?

/Checks to see if a specific category has been set
if(isset($_GET['cat'])) {

echo '<ul>';
//Foreach statement to display articles in a category
foreach($context['TPortal']['profile_articles'] as $art) {
if($art['catID']==$_GET['cat']) {

//Checks whether its empty
if ($art['subject']=='') {
//-----------------------MESSAGE!
echo '<p>No recepies have been added yet, please come back soon!</p>';
//-----------------------MESSAGE!
}
echo '
<li>' ,$art['subject'] , '';
echo '
</li>';
                                }
echo '</ul>';

                                                          }
} //End of specific category


I've tried everything, empty(), strlen($art['subject'] <=0)... nothing... I am absolutely puzzled.
Title: Re: Category List
Post by: G6Cad on September 13, 2008, 06:42:48 AM
Answer to what and where ?
Title: Re: Category List
Post by: ElShotte on September 13, 2008, 06:47:35 AM
Trying to pull articles for a categories set with "?cat=" in a custom action, is that what you meant?
Title: Re: Category List
Post by: ElShotte on September 13, 2008, 07:40:08 AM
I realized that the whole theory is wrong in that statement, the reason it wont echo it is because TECHNICALLY $art['subject'] is not empty, just the if statement prevents it from displaying, what I need to do is check if $_GET['cat'] exists in as a value in $art['catID']
Title: Re: Category List
Post by: ElShotte on September 13, 2008, 06:57:59 PM
This statement seems to work:

//Checks to see if a specific category has been set
if(isset($_GET['cat'])) {

echo '<ul>';
//Foreach statement to display articles in a category
foreach($context['TPortal']['profile_articles'] as $story) {
if($_GET['cat']==$story['catID']) {
$noarticles = 'F';
echo '
<li><a href="' . $scripturl . '?action=przepisy&page=' . $story['id'] . '">' , $story['subject'] , '</a><br />';
echo '
</li>';                                                     
}
}
echo '</ul>';
//Checks if there is no articles.
if($noarticles!='F') {
echo 'There is no articles!';
}
} //End of specific category