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.
Not a member yet? Click here to register.
Forgot Password?

Showing News in 2 Columns in 7.02+

Asked Modified Viewed 15,594 times
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
asked
Veteran Member

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.

[size=24]STEPS :[/size]

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 !!!

[size=24][ MODDED FILE FROM VERSION 7.02.03 ATTACHED ][/size]

Thank You

Regards,
Ankur Thakur
Edited by Ankur on 12-07-2011 11:07,
Ankur attached the following file:
news.zip [No information available / 818 Downloads]
0 replies

20 posts

D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

May this is what you are looking for:

http://www.phpfusionmods.co.uk/downlo...load_id=59
0 replies
Y
yousef
Y
yousef 10
  • Junior Member, joined since
  • Contributed 13 posts on the community forums.
  • Started 2 threads in the forums
answered
Junior Member

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
Edited by yousef on 25-08-2013 17:16,
0 replies
— 11 months earlier —
L
Life
L
Life 10
  • Newbie, joined since
  • Contributed 1 post on the community forums.
answered
Newbie

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 [No information available / 140 Downloads]
0 replies
— 3 months earlier —
M
m2t
M
m2t 10
  • Newbie, joined since
  • Contributed 1 post on the community forums.
answered
Newbie

Hello
Nice work Ankur, when I install it, it shows the two column with different size
0 replies
— 9 months earlier —
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

No need this is just another option. :)
0 replies
J
jikaka
J
jikaka 10
www.rusfusion.ru - russian nss
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 82 threads in the forums
answered
Veteran Member

0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

It will be released later. :)
0 replies
K
Kevin Maschke
K
<3 PHP-Fusion
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 25 threads in the forums
answered
Member

I want that paneeeel!! Pleaseee! :D
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

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
0 replies
G
gh0st2k
G
Ex Senior Dev.
  • Member, joined since
  • Contributed 131 posts on the community forums.
answered
Member

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.
0 replies
J
jikaka
J
jikaka 10
www.rusfusion.ru - russian nss
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 82 threads in the forums
answered
Veteran Member

very nice mod!
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
answered
Veteran Member

[ 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 ?
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

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
0 replies
G
gh0st2k
G
Ex Senior Dev.
  • Member, joined since
  • Contributed 131 posts on the community forums.
answered
Member

It's better to replace the core file in this case, Craig.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Cool I just have to HTML validate it and write a readme for it then I will get it released.
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
answered
Senior Member

Very nice, I really like that.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

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/
0 replies
S
sSs DeatHtAg
S
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 4 threads in the forums
answered
Junior Member

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
0 replies
J
JoiNNN
J
JoiNNN 10
  • Veteran Member, joined since
  • Contributed 850 posts on the community forums.
  • Started 100 threads in the forums
answered
Veteran Member

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.
0 replies
R
radiovega
R
  • Newbie, joined since
  • Contributed 1 post on the community forums.
answered
Newbie

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.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 20 posts
  • Votes 0 votes
  • Topic users 13 members

13 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
K
K
<3 PHP-Fusion
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 25 threads in the forums
A
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
Y
Y
yousef 10
  • Junior Member, joined since
  • Contributed 13 posts on the community forums.
  • Started 2 threads in the forums
G
G
Ex Senior Dev.
  • Member, joined since
  • Contributed 131 posts on the community forums.
J
J
jikaka 10
www.rusfusion.ru - russian nss
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 82 threads in the forums
S
S
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 4 threads in the forums
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
R
R
  • Newbie, joined since
  • Contributed 1 post on the community forums.
J
J
JoiNNN 10
  • Veteran Member, joined since
  • Contributed 850 posts on the community forums.
  • Started 100 threads in the forums
M
M
m2t 10
  • Newbie, joined since
  • Contributed 1 post on the community forums.
L
L
Life 10
  • Newbie, joined since
  • Contributed 1 post on the community forums.
D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet