Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Latest Addons
Xbox Leaderboards 9
Cookiebar Panel 73
AD Gallery 153
SyntaxHighlighte... 63
Newsletters v4.03 169
Facebook Like Box 207
Newsletters v4.02 79
Metro 236
Facebook Connect 216
Shoutbox Panel 185
Redactor for PHP... 128
MI Floating Side... 133
Facebook Login/R... 182
Avatar Studio v2.03 215
Relationship Sta... 123
Popular Addons
iTheme2 5911
Arise 5871
User Control v1.23 4684
Event Calendar 4138
Photowidget panel 3923
Radio-Theme red2... 3396
Highslide Gallery 3361
CSS/JavaScript D... 3277
Facebook Connect... 3057
Dynamic Menu 2948
Slideshow Lightb... 2770
L-AMANT 2689
Enigma 2671
2Dark 2625
Black 2621
View Thread
Official Home of PHP-Fusion » General Addon and Modification Support » Code Snippet and functions
Who is here? 1 guest(s)
 Print Thread
Showing News in 2 Columns in 7.02+
Ankur
Hello Guyz,

One of my Friend requested to have the feature of showing the News on Double Columns on the News page. So I have made some modification to the file news.php to make it work...!

Here is what I have tried and its almost what it should show as Double Column.

STEPS :

1. Backup and open your news.php file.

2. Find these Lines in this File (around Line 22):
// Predefined variables, do not edit these values
$i = 0;

3. After these Lines, Add the given below Lines :
// Counter for Displaying News in 2 Columns
$counter = 3;

4. Now Find this Line :
// Number of news displayed
$items_per_page = $settings['newsperpage'];

Change this Line to :
// Number of news displayed
$items_per_page = $settings['newsperpage']+1;

5. Now Find this Line in the File (around Line 51) :
$numrows = dbrows($result);

6. After these Lines, Add the given below Lines :
// Table for 2 Columns News
echo "<table cellpadding='2' cellspacing='2' width='100%' border='0'>\n<tr>\n";

7. Now Find these Lines (around Line 83) :
echo "<!--news_prepost_".$i."-->\n";
render_news($news_subject, $news_news, $news_info);

8. Replace these Lines with :
echo "<td valign='top' width='20%'>\n";
echo "<!--news_prepost_".$i."-->\n";
render_news($news_subject, $news_news, $news_info);
echo "</td>\n";
if (($counter % 2 == 0) && ($counter != $items_per_page+2))
{
echo "</tr>\n<tr>\n";
}
$counter++;

9. Now just after two Lines, You will Find this Line :
echo "<!--sub_news_idx-->\n";

10. Add the given below Line before the above given Line :
echo "</tr>\n</table>";


DONE !!! SAVE YOUR FILE AND TEST IT !!!

[ MODDED FILE FROM VERSION 7.02.03 ATTACHED ]

Thank You

Regards,
Ankur Thakur
Ankur attached the following file:
news.zip [2.36kB / 233 Downloads]

Edited by Ankur on 12-07-2011 10:07
 
http://ankurthakur.in/
radiovega
Honestly I have this problem with 7.02 but honestly I do not know news.php to replace these codes and I think there are many users who would like this lucru.Nu can u make us a new news.php on two collars, that changed?
Thank you very much.
 
www.radio-vega.ro
JoiNNN
radiovega wrote:

Honestly I have this problem with 7.02 but honestly I do not know news.php to replace these codes and I think there are many users who would like this lucru.Nu can u make us a new news.php on two collars, that changed?
Thank you very much.

Translated with Google translate. ^^

What he meant to say is that he also has the same problem but doesn't know how to change those lines of code and is asking for a version of news.php already modified.
 
https://github.com/JoiNNN
sSs DeatHtAg
Dont know if i did this right being a learner .

I tryed this but didnt work for me ,it just made site go crazy had to restore the news.php file
Frown

running v7.02.2
 
http://deathtagsfunservers.net
Craig
I am actually making this a panel, so we do not need to edit the core at all. See it in action at http://www.fangre...
 
http://www.fusiontube.co.uk/
afoster
Very nice, I really like that.
 
Craig
Cool I just have to HTML validate it and write a readme for it then I will get it released.
 
http://www.fusiontube.co.uk/
gh0st2k
It's better to replace the core file in this case, Craig.
Ex Senior Dev.
 
Craig
Hi Gh0st2k,

I have made a perfectly good panel for this.
Why mod the core?
Can you explain to me why you say its better to mod the core in this case?

Thanks
 
http://www.fusiontube.co.uk/
Ankur
[ MODDED FILE ATTACHED FROM 7.02.03 ] for those who have news.php as Front Page.

Craig wrote:

I am actually making this a panel, so we do not need to edit the core at all. See it in action at http://www.fangre...


That Panel looks Awesome Craig... Grin Does there any settings using which we can change the Number of News to Display ? Or the panel will take the value from News Items per page setting ?
 
http://ankurthakur.in/
jikaka
very nice mod!
www.rusfusion.ru - russian nss
 
www.rusfusion.ru
gh0st2k
It's better to use a static file in this case, cause there are normally no changes in the news file and the way you're doing it needs additional ressources. But it's not bad to have both... so everyone is able to choose.
Ex Senior Dev.
 
Craig
Yeah it's additional resources but I still think that is better than modifying the core news.php ok it does not get updated that often but it will eventually then all users must then tweak again. Like many users still use 7.01 because of Core Mods they can't or don't know how to upgrade without losing their core mods. Using a panel soon resolves that. hehe
 
http://www.fusiontube.co.uk/
Kevin Maschke
I want that paneeeel!! Pleaseee! Grin
<3 PHP-Fusion
 
http://www.km.hostei.com/php-fusion/
Craig
It will be released later. Smile
 
http://www.fusiontube.co.uk/
jikaka
http://www.php-fu...don_id=352
I think you can close the topic!
www.rusfusion.ru - russian nss
 
www.rusfusion.ru
Craig
No need this is just another option. Smile
 
http://www.fusiontube.co.uk/
m2t
Hello
Nice work Ankur, when I install it, it shows the two column with different size
 
Life
Hi, this code:
echo "</td>\n";
if (($counter % 2 == 0) && ($counter != $items_per_page+2))
{

echo "</tr>\n<tr>\n";
}


creates a blank line

can this be avoided?
Life attached the following image:
tr.png
 
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
like button in news Suspected Bugs and Errors 1 18-06-2013 21:14
There is an error with news and articles Locales Forum 6 17-06-2013 05:18
News Category Img Redo. Roadmap 10 03-06-2013 08:29
Just set up perfectly except ip showing? General Discussion 8 30-05-2013 18:21
Remove Print option/ icon from news ?? Content Administration 5 28-05-2013 01:59
Official Home of PHP-Fusion uses cookies. Some may already have been set. Read more about our Cookies here.
Please click the button I Consent Cookies to hide this bar and accept our cookies. If you continue to use the site with no action taken, we'll assume that you consent our cookies anyway.
Cookiebar Panel byVenue