News Module Tweak Help?

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   News Module Tweak Help?
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Hello Telli,

I was wondering if it was possible to do the following....

We use the standard news module but what we want is after an article has recieved 100 reads or more... that an icon would show next to the article automaticly...?

Any help would be appreciated....

xtrax1 icon_smile.gif



Back to top Reply with quote
#2   re: News Module Tweak Help?
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Anyone know how....?

I am sure its something simple maybe as if an article ID has 200 reads display image?



Back to top Reply with quote
#3   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
You could make a function and use it in the news index.


function article_icon($count, $max='200') {
   return ($count >= $max) ? '<img src="images/200reads.gif" alt="" />' : '';
}


Then where you want it just add:


echo article_icon($counter);


The second variable is for changing the count for instance you want it to show at 300.


echo article_icon($counter, 300);


The variable $counter is the database counter number from the stories table.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#4   re: News Module Tweak Help?
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Thank you telli for getting back to me I added the new function to the modules/News/index.php file at the top and then added this to the theme/ we are using

echo article_icon($counter);


But it doesnt seem to work no image is showing....

instead its showing this...

article_icon(738) on the article page?

xtrax1


Back to top Reply with quote
#5   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Are you entering it in the theme.php or the story_home.html?

Best bet would be to add it in the News/index.php




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   re: News Module Tweak Help?
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Hello Telli,

Thanks for replying back... I added it to the News Module /index.php file then I added the article_icon($count) to the story_home.html and it shows the article_icon(###) but no image...



Back to top Reply with quote
#7   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Ok because the story_home.html isnt parsed as php. Add this in the theme article function in the themes/YOURTHEME/theme.php.


$imgico = article_icon($counter);


Then in the story_home.html add the $imgico where you want it.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#8   re: News Module Tweak Help?
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Ok I got it to work but I cant seem to get the placement ... I would like it to be next or underneath the topic image yet I dont have that crontrol it shows the icon above the title - any ideas how I can accomplish this telli?

I tried using the story_home.html file and switching this

echo article_icon($counter);

to this
$popuararticle = article_icon($counter);


Then placed $popuararticle inside the story_home.html and adding it to the global tag in module/News/index.php themeindex () but no go...

any ideas would be appreciated...


Back to top Reply with quote
#9   re: News Module Tweak Help?
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Thank you telli that did it, where in buisness !

Awsome!

Thanks again....

xtrax icon_biggrin.gif



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum