News:

Wondering if this will always be free?  See why free is better.

Main Menu

Help: To show ssi_recentPosts() in two columns

Started by wjhdiz, May 13, 2008, 10:47:27 AM

Previous topic - Next topic

wjhdiz

Hi,

I am trying to feed the content from ssi_recentPosts() to my front page. I'd like the feed in two columns. How do I make it?

Thanks in advance.
Jimmy
Freedom of speech? It is freer if not speaking out.
Believing in God? Yes, talk with God every day through God creations.
Coding is poem and a way of keeping away from the troubled world.

Kindred



require_once('path/to/forum/SSI.php');

$PostList=ssi_recentPosts(5,null,'array');

foreach ($PostList as $Post) {

//use the array fields to output whatever you want from the recentPosts array in whatever format you want

}
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Spaceman-Spiff

In Mozilla and in Webkit-based browsers, you can output them as list items, and use the css style: style="-moz-column-count:2; -webkit-column-count:2; column-count:2;" (like what Wikipedia does on their References section). This will be supported in CSS 3.

However, if you want it to work in IE or other browsers, you will need to put them in the 2 columns manually (well, using the script).

Kindred

designing web pages to not work under a specific browser is incredibly bad practice.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Spaceman-Spiff

If by using a single column, it will break your design/layout, then don't use it.

But when used appropriately, it will be fine. For example, the Wikipedia References: on Firefox & Safari it will show as 2 columns, in other browsers as a single column, and it doesn't break the layout. It's just an additional feature that makes it easier to read for those who use browsers that support it.

You say bad practice. I say it's forward thinking towards CSS3.

wjhdiz

Hi,

This is great. I am new on php snips, it looks like the rest of code need to echo the array into two columns table. Could you give a bit more code on this?

Thank you very much.
Jimmy

Quote from: Kindred on May 13, 2008, 11:36:22 AM


require_once('path/to/forum/SSI.php');

$PostList=ssi_recentPosts(5,null,'array');

foreach ($PostList as $Post) {

//use the array fields to output whatever you want from the recentPosts array in whatever format you want

}

Freedom of speech? It is freer if not speaking out.
Believing in God? Yes, talk with God every day through God creations.
Coding is poem and a way of keeping away from the troubled world.

Kindred

look at the function ssi_recentPosts in SSI.php.

Look at what values are read into the array and that will tell you what values you can output...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

wjhdiz

Freedom of speech? It is freer if not speaking out.
Believing in God? Yes, talk with God every day through God creations.
Coding is poem and a way of keeping away from the troubled world.

Advertisement: