|
Showing News in 2 Columns in 7.02+
|
| Ankur |
Posted on 10-07-2011 08:27
|

Admin

Posts: 1292
Joined: 02/11/2010
|
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:
Edited by Ankur on 12-07-2011 10:07
|
| |
|
|
| radiovega |
Posted on 10-07-2011 15:07
|

Newbie

Posts: 1
Joined: 12/11/2010
|
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. |
| |
|
|
| JoiNNN |
Posted on 10-07-2011 15:58
|

Admin

Posts: 324
Joined: 05/02/2011
|
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. |
| |
|
|
| sSs DeatHtAg |
Posted on 10-07-2011 18:59
|

Junior Member

Posts: 12
Joined: 19/07/2010
|
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 |
| |
|
|
| Craig |
Posted on 10-07-2011 19:35
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
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...
|
| |
|
|
| afoster |
Posted on 10-07-2011 20:15
|

Senior Member

Posts: 427
Joined: 11/06/2007
|
Very nice, I really like that. |
| |
|
|
| Craig |
Posted on 10-07-2011 20:44
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Cool I just have to HTML validate it and write a readme for it then I will get it released.
|
| |
|
|
| gh0st2k |
Posted on 10-07-2011 21:43
|

Member

Posts: 134
Joined: 23/11/2008
|
It's better to replace the core file in this case, Craig.
Ex Senior Dev.
|
| |
|
|
| Craig |
Posted on 10-07-2011 21:50
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
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
|
| |
|
|
| Ankur |
Posted on 11-07-2011 07:00
|

Admin

Posts: 1292
Joined: 02/11/2010
|
[ MODDED FILE ATTACHED FROM 7.02.03 ] for those who have news.php as Front Page.
That Panel looks Awesome Craig... 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 ?
|
| |
|
|
| jikaka |
Posted on 11-07-2011 08:00
|

Admin

Posts: 771
Joined: 28/01/2010
|
very nice mod!
|
| |
|
|
| gh0st2k |
Posted on 11-07-2011 11:06
|

Member

Posts: 134
Joined: 23/11/2008
|
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 |
Posted on 11-07-2011 18:18
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
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
|
| |
|
|
| Kevin Maschke |
Posted on 12-07-2011 09:34
|

Member

Posts: 165
Joined: 11/12/2006
|
I want that paneeeel!! Pleaseee!
<3 PHP-Fusion
|
| |
|
|
| Craig |
Posted on 12-07-2011 11:13
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
It will be released later.
|
| |
|
|
| jikaka |
Posted on 12-07-2011 19:56
|

Admin

Posts: 771
Joined: 28/01/2010
|
http://www.php-fu...don_id=352
I think you can close the topic!
|
| |
|
|
| Craig |
Posted on 12-07-2011 20:07
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
No need this is just another option.
|
| |
|
|
| m2t |
Posted on 12-05-2012 16:35
|

Newbie

Posts: 1
Joined: 12/05/2012
|
Hello
Nice work Ankur, when I install it, it shows the two column with different size |
| |
|
|
| Life |
Posted on 12-08-2012 21:47
|

Newbie

Posts: 1
Joined: 12/08/2012
|
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:
|
| |
|