Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Showing News in 2 Columns in 7.02+

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):
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]// Predefined variables, do not edit these values
$i = 0;[/syntaxhighlighter]
3. After these Lines, Add the given below Lines :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]// Counter for Displaying News in 2 Columns
$counter = 3;[/syntaxhighlighter]
4. Now Find this Line :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]// Number of news displayed
$items_per_page = $settings['newsperpage'];[/syntaxhighlighter]
Change this Line to :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]// Number of news displayed
$items_per_page = $settings['newsperpage']+1;[/syntaxhighlighter]
5. Now Find this Line in the File (around Line 51) :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]$numrows = dbrows($result);[/syntaxhighlighter]
6. After these Lines, Add the given below Lines :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]// Table for 2 Columns News
echo "<table cellpadding='2' cellspacing='2' width='100%' border='0'>\n<tr>\n";[/syntaxhighlighter]
7. Now Find these Lines (around Line 83) :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "<!--news_prepost_".$i."-->\n";
render_news($news_subject, $news_news, $news_info);[/syntaxhighlighter]
8. Replace these Lines with :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]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++;[/syntaxhighlighter]
9. Now just after two Lines, You will Find this Line :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "<!--sub_news_idx-->\n";[/syntaxhighlighter]
10. Add the given below Line before the above given Line :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "</tr>\n</table>";[/syntaxhighlighter]

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 / 741 Downloads]
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.

Quote

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.
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
:|

running v7.02.2
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.fangree.co.uk/
Very nice, I really like that.
Cool I just have to HTML validate it and write a readme for it then I will get it released.
It's better to replace the core file in this case, 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
[ MODDED FILE ATTACHED FROM 7.02.03 ] for those who have news.php as Front Page.

Quote

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.fangree.co.uk/


That Panel looks Awesome Craig... :D 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 ?
very nice mod!
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.
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
I want that paneeeel!! Pleaseee! :D
It will be released later. :)
No need this is just another option. :)
Hello
Nice work Ankur, when I install it, it shows the two column with different size
Hi, this code:

Quote

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 file:
tr.png [5.41kB / 53 Downloads]
Hello,
Thank you for the solution, I have succeeded to change my page to 2 columns.

This function was available in version 6 by selecting 1 or 2 columns from main setting in admin panel.

Q. Why it is disabled in V. 7 ?

Regards,

Merged on Aug 25 2013 at 16:16:33:
Hello,

Quote

Q. Why it is disabled in V. 7 ?


See my post# 20, above ..
http://www.php-fusion.co.uk/forum/viewthread.php?thread_id=28996#post_181469

Is it posible to have the same function in V.7 as phpFusion V.6 ?

Please get me the answer !

Regards
Thread Information
Author
Replies
21 posts
Views
13,126 times
Last Post
Last updated on 6 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Craig, Kevin Maschke, afoster, yousef, gh0st2k, jikaka, sSs DeatHtAg, Ankur, radiovega, JoiNNN, m2t, Life, douwe_yntema