TinyPortal

Development => Block Codes => Topic started by: Dragooon on November 24, 2007, 07:56:07 AM

Title: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on November 24, 2007, 07:56:07 AM
Here is a Multi function Article Snippet which can be used as various purposes.


Features
# Have 6 modes
# You have the ability to choose either all the categories to show the article/comments from, A Single category to show them from, or multiple categories to show them from
# Ability to set the max. no. of articles to show
# Have 7 options on weather to show 7 different attributes or not, Like rating, no. of Comments, no. of views, posting time/date, author, category it is posted in, and if you are using recent comments, ability to show the articles it is in.
# Ability to make the array return for further customizations(Mainly for the ones with coding skills)


How to implement
Step 1 : Download the Attached file(ArticleSnippet.php) and as it is, upload it to your Sources Directory

Step 2 : In a PHP Block Add
// Multi Function Article Snippet
// By Dragooon
// www.gforumx.com
// Version 1.1

// Declare the globals to call the main file
global $sourcedir;

// And Call the file
require_once($sourcedir . '/ArticleSnippet.php');

// Declare it, No Need to edit this!
$cats = array();

/************************************
* About
************************************/
# Here is the way You can use it. Please keep reading this before using this snippet so that you will be able to take the full advantage of this snippet.
# There is a set of variables used later(In the function part) which are used to customize. Here is how to use them. Do Not edit the variables in this About, as it will Simply wont work :P

# $mode : This Controls the Mode. You can set it 1,2,3,4,5 or 6. Here is what each mode refers to.
# 1 : Recent Article Posted
# 2 : Top Commented
# 3 : Top Viewed
# 4 : Top rated
# 5 : Recent Comments
# 6 : Random Articles

# $limit : This controls the maximum no. of articles(Or comments if you have mode as 5) to show

# $cats : This is a array which can be specified to show articles(Or Comments if you have mode set to 5) from specific category or multiple categories. Leave blank to show from all categories or use 0 for the uncategorized ones, And use comma ( , ) as a separator. You have to enter the Category's ID not Name

# Now I'll be telling the 7 variables used for showing/not showing some stats/attributes of the article(Or Comment). Set to true if you want to show and false if don't

# $show_comments : Weather to show the no. of comments or not(Doesn't works if Mode is the 5th one).

# $show_views : Weather to show the no. of views or not(Doesn't works if Mode is the 5th one).

# $show_rating : Weather to show the rating of article and no. of voters or not(Doesn't works if Mode is the 5th one).

# $show_time : Weather to show the time the article/comment was posted on or not.

# $show_category : Weather to show the category it was posted in or not(Doesn't works if Mode is the 5th one).

# $show_author : Weather to show the articles/comments' author or not.

# $show_articleComment : Weather to show the article the comment was posted in(Only applies of Mode is the 5th one)

# $output_method : This is a tricky variable which I just included for the ones who have even Basic PHP/HTML Knowledge to customize the whole thing according to there wish. If Set as "array", this will stop showing anything but will return the variables but if set as "echo" it will show the default layout(Which is made mainly for using it in a Block). # If you are using the array method All the $show_ variable will get useless(you can use the variables returned to customize then ;) ). See the File to know what all the variables are.
# If you are using this, Make sure to set something like $item = *The rest of the function*, not just function and use a foreach loop later.
# This is the same way the SSI's $output_method behaves so if you are confused on how to use it, use it like the SSI's variable are used.
# If you don't know coding or don't want to change its looks, I recommend using it as the default "echo" method as IMO it is the best.

// This was the whole *How to* type of part. If you have questions/comments please use the Snippets Topic(From where you got it).
/************************************
* End About
************************************/

/************************************
* The Main Function
************************************/
articles(
$mode = 1,
$limit = 5,
$cats = array(),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = true,
$show_category = true,
$show_author = true,
$show_articleComment = true,
$output_method = 'echo'
);
/************************************
* And here it ends
************************************/

// Thank you for using this snippet :).

Customization and How to customize is in the Block Code.


Version 1.1 Out : New mode! Random Articles


This can be used in multiple blocks/article for various purposes. The default layout is meant for blocks.


A Special thanks to StormLrd for giving me a big testing ground to test this


Change Log :
Version 1.0
# Did the first initial release.

Version 1.0.1
# Fixed the bug in which the limit wasn't affecting Recent Comments

Version 1.1
# Added a mode 6 in which random articles will show


This has Been Tested but chances still remain of bugs/errors
Please use this thread for error reporting or feedbacks.

Thank you :)
Title: Re: Multifunction Article Snippet
Post by: Peregrinus on November 24, 2007, 11:56:43 AM
Great snippet, will definitely use this in the future on my site,

VIELEN DANK!
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 24, 2007, 12:48:26 PM
Thanks :)
Title: Re: Multifunction Article Snippet
Post by: bluedevil on November 24, 2007, 02:06:47 PM
will this snippet show the last article made in a block?

say....a linked title perhaps?
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 24, 2007, 02:07:47 PM
Ahhhhh Yes.......
Title: Re: Multifunction Article Snippet
Post by: bluedevil on November 24, 2007, 02:09:24 PM
Interesting. Im trying it now.
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 24, 2007, 02:12:02 PM
Hope you'll like it :)
Title: Re: Multifunction Article Snippet
Post by: bluedevil on November 24, 2007, 02:25:10 PM
Excellent. I love it.  Although im using very minimal features. Is only set to 3.

This is great Dragoon.  You should package this.

Top right block:

http://www.midwestavalancheclub.com/index.php
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 24, 2007, 02:29:27 PM
Glad you liked it :)
Title: Re: Multifunction Article Snippet
Post by: G6Cad on November 24, 2007, 06:00:32 PM
Way to go Dragooon :)   :up:  :D
Title: Re: Multifunction Article Snippet
Post by: tick on November 24, 2007, 06:55:31 PM
Already told ya this on msn Dragooon but nice job on this one.  I think a lot of people will find this very useful.  Nice work. Keep em coming.  :)
Title: Re: Multifunction Article Snippet
Post by: alhaudhie on November 26, 2007, 03:45:23 PM
i have this error

Fatal error: Call to undefined function articles() in /home/myforum/public_html/v10/Sources/Load.php(1764) : eval()'d code(35) : eval()'d code on line 50
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 26, 2007, 03:48:26 PM
Are you sure you uploaded the file in your /Sources directory?
Title: Re: Multifunction Article Snippet
Post by: alhaudhie on November 26, 2007, 03:51:35 PM
i have make triple check...
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 26, 2007, 04:08:27 PM
You are doing something wrong....Make sure it is in Sources directory of forum and its size on the server is 8-9 Kb
Title: Re: Multifunction Article Snippet
Post by: alhaudhie on November 26, 2007, 04:23:21 PM
Good JOOOOB...
TQ...
:up:
Title: Re: Multifunction Article Snippet
Post by: alhaudhie on November 26, 2007, 04:25:01 PM
ok... its run now...

hope... there is a option to put article intro for each article..
tq
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 26, 2007, 04:42:58 PM
There is no option for that.
Because if I trim down the body of it, Many times the HTML is unfinished causing problem in the whole page.
Title: Re: Multifunction Article Snippet
Post by: alhaudhie on November 26, 2007, 04:47:18 PM
ok... tq..

how can i make bold text for article topic?
Title: Re: Multifunction Article Snippet
Post by: domeen on November 26, 2007, 05:59:28 PM
if I select mode 5, then I get ALL the comments, and I filled in:

$mode = 5,
$limit = 5,
Title: Re: Multifunction Article Snippet
Post by: Dragooon on November 27, 2007, 02:34:36 AM
What you mean by *all*?
EDIT : OK My Bad, This is a Bug.
I'll Fix it ASAP
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: Dragooon on November 27, 2007, 03:13:57 AM
Alright Updated!
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: domeen on November 27, 2007, 07:56:07 AM
thanks, but now the block doesn't display the ratings, if I select mode 5...
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: Dragooon on November 27, 2007, 08:07:29 AM
Thats because it is clearly stated in the "About"
I simply don't find a purpose why you want to show a rating of a comment because there is no rating for comments Lol :P
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: lebisol on November 27, 2007, 06:31:06 PM
I said it before and here it is again...Excellent work man! :up:
imho this is what deafult modules should be out-of-box.
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: Dragooon on November 28, 2007, 05:55:28 PM
Thank you, Glad you liked it :)
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: fangweile on December 06, 2007, 07:04:28 AM
Very nice snippet. I really like it. Thanks a lot Dragoon for developing it. Really great. ;)
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: Dragooon on December 06, 2007, 07:10:46 AM
Glad you liked it :)
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: fangweile on December 06, 2007, 07:31:15 AM
I have question, if I want to display only article in a certain category I just change this x
$cats = array(x);  to article id right.
Title: Re: Multifunction Article Snippet [Version 1.0.1 out]
Post by: Dragooon on December 06, 2007, 07:33:16 AM
No, Change the x to category ID.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 06, 2007, 07:40:46 AM
Updated! :)
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: fangweile on December 06, 2007, 07:57:52 AM
Alright, thanks again, I also like your new random articles. :d:.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 06, 2007, 08:01:32 AM
Thanks Lol. It was based on your request only :P
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: MinasC on December 12, 2007, 08:43:11 AM
is there a demo to see how it looks ?
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 12, 2007, 09:03:48 AM
Sorry but No. Since I made this on my local PC.

You can always try. And if you don't like its look, you can change them,.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: MinasC on December 12, 2007, 09:22:35 AM
ok thnx
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 12, 2007, 09:25:48 AM
Make sure to leave me a feedback(No matter weather good or Bad).
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Texas Liberty Lady on December 12, 2007, 12:57:42 PM
As a newbie could you tell me which PHP box to add in?  You said any but with my limited knowlege I'd like specific info please.  Thanks so much.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Texas Liberty Lady on December 12, 2007, 01:01:07 PM
Also where do I get it?  thanks.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 12, 2007, 01:06:46 PM
There is only 1 PHP Block and what do you mean with your second post?
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Texas Liberty Lady on December 12, 2007, 05:29:49 PM
I simply could not see where to download it.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 12, 2007, 05:44:11 PM
There is a attachment in the first post of this thread. Do as the steps of the implementation part say,
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: lebisol on December 16, 2007, 02:08:38 AM
Hey Dragoon!
I liked this snip very much that I edited it so it displayes in table format using theme elements. Again, this is just the candy on top of your hard work. Let me know what you think here is the screenshot.
Thanks again for making this!
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 16, 2007, 04:00:53 AM
Thats cool!
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: sanax on December 21, 2007, 05:44:53 PM
Very good lil snippet!... Dragoon, I have a question... is it possible to add font size and font color to the script? I'd like to make the links more visible with a bold font or change the color...
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 21, 2007, 05:59:28 PM
You can always edit the file, See the foreach loop in it.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: alhaudhie on December 26, 2007, 01:48:41 AM
how can this Article Snippet be adding the intro of article?...
i think this is a good choice..
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on December 26, 2007, 02:56:07 AM
I wont add even the intro because even its HTML can break the whole page.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: MinasC on December 27, 2007, 01:48:27 PM
Quote from: Dragooon on December 12, 2007, 09:25:48 AM
Make sure to leave me a feedback(No matter weather good or Bad).

works like a charm ! thnx !
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: koolaid on March 03, 2008, 09:24:20 PM
awesome snippet! I love it.

How can you turn $show_comments to a link so that it goes to the comments section of an article? I;m using the snippet to show the top rated (mode 4)

Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: FERNSIDEâ„¢ on March 04, 2008, 01:15:07 AM
Very nice Dragooon :)
At the moment, I have no use for it, but it's sitting there waiting  to be switched on.
Nice work aswell lebisol.:)
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Spasm on March 13, 2008, 05:06:18 PM
Great snippet!  Thanks! One question though...


For the top rated option, is there a way to display it from highest to lowest of the top 5?  It's showing the top 5 which is great, but it shows an article rated in this order:

1 - Rated 9
2 - Rated 8
3 - Rated 9
4 - Rated 7
5 - Rated 10

When I think it should be...

1 - Rated 10
2 - Rated 9
3 - Rated 9
4 - Rated 8
5 - Rated 7
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: koolaid on March 13, 2008, 06:08:10 PM
I use the top rated option too and the same thing happens to me. It displays it as:

1 - Rated 5
2 - Rated 4
3 - Rated 5
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on March 14, 2008, 07:31:25 AM
I thought it would do something like that, I'll try to find a solution.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Spasm on March 15, 2008, 06:02:52 PM
Quote from: Dragooon on March 14, 2008, 07:31:25 AM
I thought it would do something like that, I'll try to find a solution.

Great, thanks for considering!
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on March 16, 2008, 04:01:05 AM
Meh, No luck so far. I am still trying what I can do lol.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Spasm on March 16, 2008, 05:35:01 PM
Quote from: Dragooon on March 16, 2008, 04:01:05 AM
Meh, No luck so far. I am still trying what I can do lol.

Yea, it's weird because now a different article came up, rated 7 (first rate) and replaced the one that was a 10 :)... 
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: osu searles on March 17, 2008, 09:56:59 PM
Great Snippet!

Is there a way to include the intro text with the article?

What I would really like to do (and I'm not sure this is the right snippet to be doing it in) is to post the intro to a random article from a single catagory (so one intro displayed at a time).

Thanks.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: koolaid on June 04, 2008, 11:08:43 PM
would it be possible to use this in an article?

What I have is a table of all the articles and i would like to the post info (# of comments, rating, views) for each article beside it.

I tried it in a php article and it didn't work. I just pasted the code from the first post (block code) and got some errors. I tried to solve it by removing what was causing an error but it never resolved.

Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: JPDeni on June 04, 2008, 11:42:40 PM
You might post the code you used and we could see if we could help find the problems with it.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: koolaid on June 05, 2008, 12:26:14 AM
I tried out the code used for the block hoping it might work in a php article. Mind you, i don't know much in coding php.

// Multi Function Article Snippet
// By Dragooon
// www.gforumx.com
// Version 1.1

// Declare the globals to call the main file
global $sourcedir;

// And Call the file
require_once($sourcedir . '/Artclestats.php');

// Declare it, No Need to edit this!
$cats = array();

/************************************
* About
************************************/
# Here is the way You can use it. Please keep reading this before using this snippet so that you will be able to take the full advantage of this snippet.
# There is a set of variables used later(In the function part) which are used to customize. Here is how to use them. Do Not edit the variables in this About, as it will Simply wont work :P

# $mode : This Controls the Mode. You can set it 1,2,3,4,5 or 6. Here is what each mode refers to.
# 1 : Recent Article Posted
# 2 : Top Commented
# 3 : Top Viewed
# 4 : Top rated
# 5 : Recent Comments
# 6 : Random Articles

# $limit : This controls the maximum no. of articles(Or comments if you have mode as 5) to show

# $cats : This is a array which can be specified to show articles(Or Comments if you have mode set to 5) from specific category or multiple categories. Leave blank to show from all categories or use 0 for the uncategorized ones, And use comma ( , ) as a separator. You have to enter the Category's ID not Name

# Now I'll be telling the 7 variables used for showing/not showing some stats/attributes of the article(Or Comment). Set to true if you want to show and false if don't

# $show_comments : Weather to show the no. of comments or not(Doesn't works if Mode is the 5th one).

# $show_views : Weather to show the no. of views or not(Doesn't works if Mode is the 5th one).

# $show_rating : Weather to show the rating of article and no. of voters or not(Doesn't works if Mode is the 5th one).

# $show_time : Weather to show the time the article/comment was posted on or not.

# $show_category : Weather to show the category it was posted in or not(Doesn't works if Mode is the 5th one).

# $show_author : Weather to show the articles/comments' author or not.

# $show_articleComment : Weather to show the article the comment was posted in(Only applies of Mode is the 5th one)

# $output_method : This is a tricky variable which I just included for the ones who have even Basic PHP/HTML Knowledge to customize the whole thing according to there wish. If Set as "array", this will stop showing anything but will return the variables but if set as "echo" it will show the default layout(Which is made mainly for using it in a Block). # If you are using the array method All the $show_ variable will get useless(you can use the variables returned to customize then ;) ). See the File to know what all the variables are.
# If you are using this, Make sure to set something like $item = *The rest of the function*, not just function and use a foreach loop later.
# This is the same way the SSI's $output_method behaves so if you are confused on how to use it, use it like the SSI's variable are used.
# If you don't know coding or don't want to change its looks, I recommend using it as the default "echo" method as IMO it is the best.

// This was the whole *How to* type of part. If you have questions/comments please use the Snippets Topic(From where you got it).
/************************************
* End About
************************************/

/************************************
* The Main Function
************************************/
articles(
$mode = 1,
$limit = 5,
$cats = array(1),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
);
/************************************
* And here it ends
************************************/

gfjfjfhj
gjygjgh';




Heres the error i got:

Parse error: syntax error, unexpected T_ECHO in /home/.eris/Sources/Load.php(1735) : eval()'d code(210) : eval()'d code on line 73
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: JPDeni on June 05, 2008, 01:12:50 AM
I can't figure out the original code, now that I look at it.

I'm pretty sure that you don't want this at the bottom of your code:


gfjfjfhj
gjygjgh';



But then I don't understand how the array works above it either.

Maybe Dragoon will be able to help.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: fangweile on June 05, 2008, 04:05:03 AM
can i use the  two or three modes at a same time in one code. I want to have three columns there with different modes. One for top rated article, for random article and for most viewed article.


of course if will add this in the frontpage block.
Any one know how to do this? I will really appreciate any help. THanks in advance
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on June 05, 2008, 04:48:27 AM
Quote from: fangweile on June 05, 2008, 04:05:03 AM
can i use the  two or three modes at a same time in one code. I want to have three columns there with different modes. One for top rated article, for random article and for most viewed article.


of course if will add this in the frontpage block.
Any one know how to do this? I will really appreciate any help. THanks in advance
Just add it in the 3 boxs
It will work.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: fangweile on June 05, 2008, 05:41:28 AM
Nope, I want to show the three modes in one block with three columns.
I have tried it and it works but it is rather show as vertical/row alignment.
I don't know what code to use and I already made a trial and error but there is no luck.
Any idea?
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on June 05, 2008, 08:07:09 AM
You can use
<table><tr><td>',first,'</td><td>',second,'</td><td>',third,'</td></tr></table>
And copy the variable/function 3 times and change the variable names

Am I being clear? :P
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: bobzr on June 05, 2008, 08:18:03 AM
Congrats Dragoon this is a great snippet especially the Most Viewed ..

Will it be possible to get the "Most viewed" for the current month/ week /.. or anything other recent period of time.
In fact, after long time, oldest articles are obviously always on top because they have been seen from the begin.

Thanks!
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on June 05, 2008, 08:52:33 AM
I am not sure on how to get that, i'll see.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: fangweile on June 06, 2008, 02:00:23 AM
omg, thanks a lot Dragoon.

I already do that but it displays nothing
here is the code I used.


echo'<table><tr><td>'

articles(
$mode = 1,
$limit = 5,
$cats = array(1),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
);
'</td><td>'articles(
$mode = 3,
$limit = 5,
$cats = array(3),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
);'</td><td>'articles(
$mode = 5,
$limit = 5,
$cats = array(4),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
);'</td></tr></table>';


I think my code is not that right.

Please pardon me for my PHP ignorance.  :(
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Dragooon on June 06, 2008, 06:19:30 AM
Try
echo'<table><tr><td>',

articles(
$mode = 1,
$limit = 5,
$cats = array(1),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
),
'</td><td>'articles(
$mode = 3,
$limit = 5,
$cats = array(3),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
),'</td><td>',articles(
$mode = 5,
$limit = 5,
$cats = array(4),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
),'</td></tr></table>';
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: fangweile on June 06, 2008, 08:35:56 AM
hello dragoon

I have tried your code but it doesnt show either.


[edit]
I have figured it out:
here is the code i used:


echo'<table><tr><td>';articles(
$mode = 1,
$limit = 5,
$cats = array(),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = true,
$show_category = true,
$show_author = true,
$show_articleComment = true,
$output_method = 'echo'
);

echo'</td><td>';articles(
$mode = 1,
$limit = 5,
$cats = array(),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = true,
$show_category = true,
$show_author = true,
$show_articleComment = true,
$output_method = 'echo'
);

echo'</td><td>';articles(
$mode = 1,
$limit = 5,
$cats = array(),
$show_comments = true,
$show_views = true,
$show_rating = true,
$show_time = true,
$show_category = true,
$show_author = true,
$show_articleComment = true,
$output_method = 'echo'
);
echo'</td></tr></table>';


I was having a trial and error and then luckily its perfectly works.
Thanks a lot Dragoon.
This article snippet is really great.





@koolad

maybe you just copy the wrong code there

require_once($sourcedir . '/Artclestats.php');

It must be

require_once($sourcedir . '/ArticleSnippet.php');
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: koolaid on June 06, 2008, 07:05:00 PM
Quote@koolad

maybe you just copy the wrong code there

The filename is right. I changed how that php displays the info into this:

Comments: 1 | Views: 519
Rating: (5 Votes)

and renamed to Artclestats.php for articles since i use ArticleSnippet.php for the blocks. The code works fine in a block so i'm sure that the filename isn't the problem.

I'm trying to get it to work inside a php article because i have a list of articles with which i would like to display the above info beside each of them.

Dragoon is that possible?
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: supportingactors on July 25, 2008, 06:51:34 PM
It's a great block snippet -- which as was mentioned earlier should be one of the standard features :)

One thing I've been searching for, which I'm hoping this might be able to accomplish (or be modded to do): is there a way to have it output to an XML/RSS feed of the articles' titles? So far as I can find there's no one who's created such a thing for TP .98. (Does TP 1.0.5b include RSS?)
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: IchBin on July 25, 2008, 07:20:27 PM
Any questions not related to the topic should be posted in their own topic in the appropriate board. Feature requests would be a good place to start your post after you search the board to make sure it hasn't been requested already.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: supportingactors on July 25, 2008, 07:31:26 PM
Quote from: IchBinâ,,¢ on July 25, 2008, 07:20:27 PM
Any questions not related to the topic should be posted in their own topic in the appropriate board.
I *was* asking about this block and whether it can output to an XML format -- the question about 1.0.5 was ancillary, since if it already includes RSS, then it makes such a block less necessary.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: limteam on August 20, 2008, 12:46:50 AM
Hi  its a great mod. But  how to set articles in horizontal position?
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: alhaudhie on January 25, 2009, 04:19:04 PM
how can i put the background image? I have this

// echo  '<div style="width: 100%; height: 135px; overflow: auto">';
echo '<table border="0" width="100%" cellspacing="1" cellpadding="1" id="RecentArticlesTBL" class="bordercolor">
<tr align="center" valign="middle" class="catbgcustom">
<td colspan="2"><span class="smalltext">Artikel Terbaru</span></td>';
// Show author column?
if($show_author)echo'
<td><span class="smalltext">Author:</span></td>';
// Show category column?
if($show_category)echo'
<td><span class="smalltext">Kategori</span></td>';
// Show the time its posted on column
if($show_time)echo'
<td><span class="smalltext">Published on:</span></td>';

// Show views column?
if($show_views)echo'
<td><span class="smalltext">Paparan</span></td>';
// Show comments column?
if($show_comments)echo'
<td><span class="smalltext">Ulasan</span></td>';
echo'</tr>';
foreach ($items as $i)
{
$counter++;
echo '<tr align="left" valign="middle">
       <td class="windowbg2">
   <img src="' . $settings['images_url']. '/topic/folder.png" width="16" height="16" border="0" alt="" /></td>
       <td class="windowbg"><span class="smalltext">',$i['article']['artLink'],'</a></span>';
echo '';
echo '</div>';
// Show the author?
            if($show_author)
            echo '<td class="windowbg2"><span class="smalltext">',$i['author']['link'],'</span></td>';

// Show its category?
            if($show_category && $i['article']['is_categorized'])
            echo '<td class="windowbg"><span class="smalltext">',$i['cat']['link'],'</span></td>';

            // Show the time its posted on
if($show_time)
            echo '<td class="windowbg"><span class="smalltext">',$i['article']['time'],'</span></td>';

// Show there ratings?
if($show_rating)
{

// Is it rated?
    if($i['article']['is_rated'])
    {
        echo '<td align="center" class="windowbg2"><span class="smalltext">',str_repeat('<img src="'.$settings['images_url'].'/tpblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $i['article']['rating']),' (',$i['article']['voters'],' rates)</span></td>';
        }
// No?
        else
        {
       



        }


// Show the no. of views?
if($show_views)
  echo '<td align="center" class="windowbg"><span class="smalltext">',$i['article']['views'],' </span></td>';


// Show the no. of comments?
if($show_comments)
    echo '<td align="center" class="windowbg"><span class="smalltext">',$i['article']['comments'],'</a></span></td>';


    }


echo '</span></td>';
if($counter < $limit)
echo '';
}
echo '</table>';
}


i want to put only one background image for all table.
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: IchBin on January 26, 2009, 02:57:55 AM
Let me google that for you! (http://letmegooglethatforyou.com/?q=css+background)
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: Renegd98 on January 26, 2009, 03:10:00 AM
I have to admit I have never seen that Ichbin...  too good...
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: IchBin on January 26, 2009, 03:45:20 AM
I only use it for those types of things that can be learned about with a simple google search. :D
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: kopijun on February 16, 2009, 05:49:14 AM
Hi, is it possible to display the poster avatar with this snippet ?
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: alhaudhie on February 19, 2009, 06:24:25 PM
how can we make the post with two different background colour alternately?
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: kopijun on November 07, 2009, 07:01:01 PM
Quote from: kopijun on February 16, 2009, 05:49:14 AM
Hi, is it possible to display the poster avatar with this snippet ?

just expecting someone could help... :-\
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: G6Cad on November 08, 2009, 08:44:14 PM
Quote from: kopijun on November 07, 2009, 07:01:01 PM
Quote from: kopijun on February 16, 2009, 05:49:14 AM
Hi, is it possible to display the poster avatar with this snippet ?

Did you read through the posts in this topic ?  I think this have been discussed earlier in this very topic
just expecting someone could help... :-\
Title: Re: Multifunction Article Snippet [Version 1.1 out]
Post by: kopijun on November 09, 2009, 04:40:26 AM
Quote from: G6 on November 08, 2009, 08:44:14 PM
Quote from: kopijun on November 07, 2009, 07:01:01 PM
Quote from: kopijun on February 16, 2009, 05:49:14 AM
Hi, is it possible to display the poster avatar with this snippet ?

Did you read through the posts in this topic ?  I think this have been discussed earlier in this very topic
just expecting someone could help... :-\

I read through it G6, and I think I can't find anything about displaying avatar using this snippet..