TinyPortal

Development => Support => Topic started by: Bec on March 27, 2009, 02:06:04 AM

Title: Question about articles
Post by: Bec on March 27, 2009, 02:06:04 AM
Hi Everyone,

I want to create a new article which shows a specific categories articles in it and a short tidbit from the article and then readers have to click on it to read the full article with the articles listed under each other with a photo to the left of it.

Similar to what you have for the front page blocks but I want to have it showing in an article instead of a block so I can link it up to my main menu... is this possible?

I can pretty much get exactly what I want by linking the articles into another article but I would really like to show a little tidbit of the article to get readers interest..

Hope it makes sense!

Thanks!

Title: Re: Question about articles
Post by: Ianedres on March 27, 2009, 02:12:20 AM
Would using '?cat=x' after your 'domain.com/index.php' link not achieve what you want using intros to the articles?

Edited to add: Where 'x' = your category # for the articles.
Title: Re: Question about articles
Post by: Bec on March 27, 2009, 02:29:00 AM
That worked a charm, thank you!

Only thing is I don't want to show this info for the articles.

written 30 April 2008, 13:26:00
240 Views | Rating: (1 rates)

I have removed all of the options in each article but its still showing...
Title: Re: Question about articles
Post by: Bec on March 27, 2009, 03:34:25 AM
Not to worry, I got some inspiration and made my own :)
[url removed]
Title: Re: Question about articles
Post by: Ianedres on March 27, 2009, 03:45:13 AM
Great work Bec.

Marking as solved.
Title: Re: Question about articles
Post by: Bec on March 27, 2009, 03:47:12 AM
Thanks :)
Title: Re: Question about articles
Post by: IchBin on March 28, 2009, 04:51:10 AM
The problem with those options is a bug, and its fixed for the next beta. :)
Title: Re: Question about articles
Post by: Bec on March 28, 2009, 04:45:28 PM
Cool! Thanks :)
Title: Re: Question about articles
Post by: willcom on July 15, 2009, 09:51:44 AM
Bec

I love your site.  I really would liketo know how you achieved the whole articles thing, how you managed to get the index.php?action=articles to show your article intro's on a page with links into the full articles.

I'm trying to get the same thing on my home page with article intro's and would love to have an articles page like yours  :D
Title: Re: Question about articles
Post by: Bec on July 24, 2009, 12:14:58 AM
Hi willcom,

Thanks :)

Ok it is all done manually, firstly created a new article and inserted a table (i tend to keep an extra column/row between each to spread them out a bit more and keep it tidy) - in the first column insert link for your photo... in the 3rd column insert your article title and some intro text from your article (simply just copy this from your article) and then link the article up via the read more link.. (you will need to create your article first so you have the link).. hope that explains it. Am more than happy to help you out more if you like, I am pretty sure I saw you as a member so just contact me through the pm system and I'll help you out :)
Title: Re: Question about articles
Post by: willcom on July 24, 2009, 09:30:32 AM
Thanks Bec, that's cheating but I like your approach.  I was thinking that maybe you'd written some really clever code, I didn't even think about doing that.  I did find and modify some code if you want to automate your page, it will work with your tables if you splice it up.

Have a go and see what you think, you can specifiy which article it is in the call WHERE c.id IN ('1', '2') This one brings back all articles in cat 1 & 2 so you can put all your articles in one page and split them up on others like you have.  This goes in a php code block.

$max_shown=5;
$articles=db_query("SELECT a.id,a.subject,a.intro,a.author,a.authorid,a.date,c.value1 as category,a.category as category_id, IF(length(c.value4) > 0,c.value4,'/sorcey/tp-files/tp-articles/icons/TPadm-article.gif') as category_img FROM smf_tp_articles a inner join smf_tp_variables c on a.category = c.id WHERE c.id IN ('1', '2') AND approved=1 AND off=0 ORDER BY date DESC LIMIT " . $max_shown, __FILE__,__LINE__);
$cnt=0;

While ($row=mysql_fetch_row($articles))
{
    echo '<table cellspacing="0" cellpadding="0" width="100%" style="margin-top: 4px;
             margin-bottom: 4px;" border="0"><tr><td>';
    echo '
    <p><a href="index.php/cat,' . $row[7] . '.html"><img src="' . $row[8] . '" align="left" hspace="5"></a> <a href="index.php/page,' . $row[0] . '.html"><b><h3 style="margin-bottom:0px">' . $row[1] . '</h3></b></a>
<font style="margin-left:27px" size="1"><em>by <a href="index.php?action=profile;u=' . $row[4] . '"><b>' . $row[3] . '</b></a> on ' . date( "d/m/y", $row[5] ) . '</em></font></div>
<p>' . $row[2] . '  <strong><a href="index.php/page,' . $row[0] . '.html">read more...</a></strong></p>
     </p></td>';
     echo '</tr></table>';
   $cnt++;
}
If  ($cnt=0) {
    echo '<td>No Articles Available';
    }


This post should help you a little.  Not sure on how to show the image for the article but I beleive it's in there somewhere, I'll update if I find it.

http://www.tinyportal.net/index.php/topic,3320.0.html (http://www.tinyportal.net/index.php/topic,3320.0.html)
Title: Re: Question about articles
Post by: Bec on July 24, 2009, 09:42:28 AM
No cheating :P I got the look the wanted, who cares how I got it lol

Thanks matey!