Support ⇒ Explain Please :: Archives ⇒ How to have 2 news side by side? :: Archived ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexExplain Please

Archived ⇒ How to have 2 news side by side?


Hi Jerry,
I wish I could help, if I could I would be doing a lot of template work myself. Good Luck.

Gerald Scott
Asheville, NC US

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
. . . . . . . . .. . . . . . ( Linux 2.6.9 / 2.2.3 / 5.0.22 / 5.1.6 / 9.1.2.1 )


Hey all. I've been doing some modifications along the lines suggested in this thread and managed to reproduce the two-column layout when using the default Dragonfly theme.

However, I'd like to do a similar thing with a modified version of the fisubsilver-theme, but I just can't get my head around what I'm doing wrong, since I basically can limit the width of the news item, but I can't get it to appear in two columns...
Any insightful persons out there that might have an idea?

<!-- BEGIN newsempty --> <table width="100%" border="0" cellspacing="0" cellpadding="4"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="1"> </tr> <tr> <td bgcolor="#006699"><table width="100%" border="0" cellspacing="0" cellpadding="0"> </tr> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="0"> </tr> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="4"> </tr> <tr> <td> <center> <font class="title">{newsempty.S_SITENAME}</font><br /><br /> {newsempty.S_NOTOPIC}<br /><br /> [ <a href="{newsempty.U_NEWSINDEX}">{newsempty.S_GONEWS}</a> | <a href="{newsempty.U_TOPICS}">{newsempty.S_SELECT}</a> ] </center> </td> </tr> </table> </td> </tr> </table></td> </tr> </table></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" class="tbl"> <tr> <td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /> </td> <td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /> </td> <td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /> </td> </tr> </table> </td> </tr> </table--> <!-- END newsempty --> <!-- BEGIN newscat --> <table class="newsindex"> <tr> <td> <center><font class="title">{newscat.S_SITENAME}: {newscat.S_TOPIC_T}</font><br /><br /> <form action="{newscat.U_SEARCH}" method="post" {I18N}> <input type="hidden" name="topic" value="{newscat.I_TOPIC}" /> {newscat.S_SEARCHON}: <input type="name" name="search" size="30" maxlength="255" />   <input type="submit" value="{newscat.S_SEARCH}" /> </form> [ <a href="{newscat.U_HOME}">{newscat.S_GOHOME}</a> | <a href="{newscat.U_TOPICS}">{newscat.S_SELECT}</a> ]</center> </td> </tr> </table> <br /> <!-- END newscat --> <!-- DEFINE $LEFT_ARTICLE = true --> <table> <tr> <!-- BEGIN newstopic --> <td style="width:45%" cellpadding="4"> <tr> <td style="vertical-align: top;"> <table border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td bgcolor="#006699"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <td height="27" background="themes/fisubsilversh/images/cellpic1.gif" bgcolor="#EAEDF4"> <div align="left"><font class="title"> <b>{newstopic.S_TITLE}</b></font></div> </td> </table> </td> </tr> </table> </td> <td> </td> </tr> <tr> <td style="vertical-align: top;"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td bgcolor="#006699"> <table width="100%" border="0" cellspacing="0" cellpadding="4"> <td bgcolor="#EAEDF4" valign="top">{newstopic.S_STORY} <!-- IF newstopic.S_NOTES --> <br /><br /><br /><b>{newstopic.S_NOTE}</b><i>{newstopic.S_NOTES}</i> <!-- ENDIF --> </td> <td bgcolor="#EAEDF4" valign="top"><a href="{newstopic.U_NEWTOPIC}"><img src="{newstopic.IMG_TOPIC}" alt="{newstopic.S_TOPIC}" border="0" align="right" hspace="2" vspace="2" /></a> </td> </table> </td> </tr> </table> </td> </tr> <tr> <td style="width:30%; vertical-align: top"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td bgcolor="#006699"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <td nowrap bgcolor="#EAEDF4" background="themes/fisubsilversh/images/cellpic4.gif"> <div align="center"> <!--font class="content">{newstopic.S_POSTEDBY} {newstopic.S_INFORMANT} {newstopic.S_ON} {newstopic.S_TIME} {newstopic.S_READS}</font><br--> <font class="content">{newstopic.S_MORELINK}</font></div> </td> </table> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" class="tbl"> <tr> <td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /> </td> <td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /> </td> <td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /> </td> </tr> </table> </td> <td> </td> </tr> </td> <!-- IF $LEFT_ARTICLE --> <!-- DEFINE $LEFT_ARTICLE = false --> <!-- ELSE --> </tr><tr> <!-- DEFINE $LEFT_ARTICLE = true --> <!-- ENDIF --> <!-- END newstopic --> </tr> </table>
Any ideas?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/2.0.52/5.0.15/5.0/9.0.6.1


Has anybody figured out how to get this layout to work on their site? Holy Cow! THis is definitely what I need, if only I could figure out how to get it to work!


DJMaze wrote
I didn't test the following but it should work

Use the following inside the loop
<!-- DEFINE $LEFT_ARTICLE = $LEFT_ARTICLE+1 -->

Then a little further down inside the loop use
<!-- IF $LEFT_ARTICLE % 2 = 0 -->

What does this do?
A % is a 'mod' calculation it's like (x = x-((x / 2) * 2))

Say x = 6 then:
x / 2 = 3
x * 2 = 6
x - 6 = 0

If x = 7 then:
x / 2 = 3.5 = 3
x * 2 = 6
x - 6 = 1

That way you can use something like:
<table> <!-- IF $LEFT_ARTICLE % 3 = 0 --> <tr><td>message</td> <!-- ELSEIF $LEFT_ARTICLE % 3 = 1 --> <td><table><tr><td>message</td> <!-- ELSEIF $LEFT_ARTICLE % 3 = 2 --> <td>message</td></tr></table></td> <!-- ENDIF -->

This will output: ┌─────────────┬─────────────┐ │ │ │ │ │ Article 2 │ │ │ │ │ Article 1 ├─────────────┤ │ │ │ │ │ Article 3 │ │ │ │ └─────────────┴─────────────┘
Shure it's not the best method if there are NOT 3, 6, 9, etc. articles but it gives you an idea how powerfull themeing actualy is.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD 4.9/MySQL 4.1.11/PHP Version 4.4.8/DragonFly 9.2.1


How to add truncate to this? I want all the news "blocks" to be the same size.

www.jzky.net a Dragonfly site. cms.jzky.net < test site. - Pardon my bad englsih Wink
My home town

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / Apache / PHP Version 5.2.0 /MySQL Version 4.1.21-standard / CMS Version 9.1.1


Truncating will only work for text, it can't account for new lines, as in linebreaks, i found this out when i did it, so you will find they don't always quite match up.

Here's the code i used from which one of the DF team members made for me a while back, though the variable name can be pretty much anything you like other then something that exists already.

Findrow['hometext'] = decode_bb_all($row['hometext'], 1, true);
Change with$nochar = '300'; $newsnip = $row['hometext'] = decode_bb_all($row['hometext'], 1, true); $newsnip = (strlen($newsnip)>$nochar)?substr($newsnip,0,$nochar).'......':$newsnip;

Where 300 is the max amount of characters to show.

Backup first, change code, clear cache, test, if errors, put backup back and post error in a new thread since we're vearing off-topic here.

You'll find you might want to always display the Read More link when you use this, which means further adjustments, otherwise unless you have something in the extra section for the article the read more link will not be there and you'll be missing half an article with no easy way for users to view the missing text.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
XP / 2.0 / 5.1 / 5.2 / none


Is there any news on this? I would love to have a layout like the front page of this support site for instance.
Have 2 colums, with four news items.

I can't even seem to change that, as the news is always 5, never four or one for instance...

I'm not lost, I'm locationally challenged.
Don't you agree? God created some pretty good textures!
Proud admin of FokGuildwars.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Since i can't figure out how to change / accomplish this for the TCD_natural theme, I posted a question in the forums over there.
In the meantime I sure will watch this topic, as I'm curious on how to get the news to show up side by side, with a maximum of 4 news items for all members...

I'm not lost, I'm locationally challenged.
Don't you agree? God created some pretty good textures!
Proud admin of FokGuildwars.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


ok, I managed to get a x number of news items on the frontpage. So that's no longer an issue.

What I do wonder however, is why this post has been sticky for as long as it has. Devon, over at TCD, didn't find this information usefull enough to implement this code into his OWN theme, wich kind of makes me wonder, who would ever benefit from this post.

The NSN Centreblocks suggested in this thread, shows four blocks in the right way, but the content is limited to blocks. Therefor I cannot put any news items in it, so that wouldn't fix it at all.

Thanks in advance for shining light on this, as both this site aswell as the Pitcher support site, have four items on the main page. Even though I'm beginning to wonder if that is the news module, showing it...

I'm not lost, I'm locationally challenged.
Don't you agree? God created some pretty good textures!
Proud admin of FokGuildwars.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Well, you may be better off with Pro_News, which can co-exist alongside News, but more importantly is fully templated. While there are no templates (yet) for 2-columns, writing new templates would be a much less steep learning curve than re-coding a whole theme.

CSS can handle wrapping images in a Z-shape pattern down the screen, so a container per Pro_News article... ? And most of the existing templating is already CSS (vs. tables). How good is your CSS? Or your google'ing expertise? Wink Here's a pointer for tiling images.

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


Any news on this yet? Still would love to implement this feature through a block or something. Switching to pronews didn't quite cut it... And the default news system is able to...

Anyone that can offer the final solution?

I'm not lost, I'm locationally challenged.
Don't you agree? God created some pretty good textures!
Proud admin of FokGuildwars.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Good question. It would seem that around the end of April layingback simly fell off the earth.

You should check his site for any info if you can't find any here.

J.
j e r u v y a t y a h o o d o t c o m

Need help? Look here: www.dragonflycms.org/W...d=112.html
Need to chat? Look for me on irc.freenode.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Ubuntu7.10/Debian3.1 - 2.2.3/1.3.37 - 5.0.38/4.0.27 - 5.2.1/4.4.7 - CVS/9.1.2}


layingback didn't fall of the planet - though I was very, very busy with other things (think paying bills, etc., and you get the picture Wink )

I hope I'll get the time to make the next release of Pro_News this year, but can't promise.

My last post wasn't about what I could/would do though, but about encouraging someone else to do it. It's CSS after all not PHP code. PHP isn't hard to learn, although you do need good understanding of Dragonfly and DBMS, but if the serious webmaster of a DF site doesn't want to at least experiment if not master HTML/CSS then they are really missing out, IMHO.

BTW, I had imagined that if I 'broke the camel's back' on getting old Pro_News working, that some number of others would be tweaking and improving it by now... But not so much as a shared template, even though I see many good Pro_News templates out there. Makes one wonder at times if there's any real point releasing ....

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


Good to hear you didn't fall.

Look forward to hearing about your updates. Keep in mind doing a full blown release might be premature, but certainly interim patchs for now would be all that are needed. Heck I've seen a few in the forums already.

P.S. Bills, ya boy I know them Smile

J.
j e r u v y a t y a h o o d o t c o m

Need help? Look here: www.dragonflycms.org/W...d=112.html
Need to chat? Look for me on irc.freenode.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Ubuntu7.10/Debian3.1 - 2.2.3/1.3.37 - 5.0.38/4.0.27 - 5.2.1/4.4.7 - CVS/9.1.2}

All times are UTC