This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

2 columns layout for news


avatar
cosmin 269
From: -
2 columns layout for news

I do not want to use tables, so I went around changing templates. I've resorted to a CSS layout which gave pretty good results with Google. It all worked out until I got to changing the 2 column news layout.
How can I get the news to appear like this?

 http://www.file-portal.net/test/test_2_col.html
I've changed the news_col_footer,news_col_header, news_col_middle templates, but because they loop, when changing the layout, the left and right div loop, and the result is not only different from what I want it's bad in a different way, especially in Opera.
 http://www.file-portal.net/test/loop_problem.html

I mean, why do the header and footer loop? Shouldn't they work more like the site header and footer in this particular case?

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: 2 columns layout for news
avatar
OP 269
From: -
2 columns layout for news

Works great now, thank you.
1 Re: 2 columns layout for news
avatar
Administrator
1340
From: Vienna, Austria
2 columns layout for news

Open index.php and find:
                $result = DBQuery("SELECT * FROM esselbach_st_stories WHERE (story_time LIKE '%$story_date_array[$a]%') AND story_main = '1' AND story_website = '$website' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') OR (story_time LIKE '%$story_date_array[$a]%') AND story_main = '1' AND story_website = '0' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC");

and add:

                $news = mysql_num_rows($result);

$news2 = round($news/2);
$news++;

Replace:

if (!$newsrow) 

{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$newsrow = 2;
}

$mainnews .= GetTemplate("news_col_news");

if ($newsrow == 2)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}

with:

                        if (!$newsrow)

{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == $news2)
{
$mainnews .= GetTemplate("news_col_middle");
}

$mainnews .= GetTemplate("news_col_news");
$newsrow++;

if ($newsrow == $news)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}

Find:

            $result = DBQuery("SELECT * FROM esselbach_st_stories WHERE story_main = '1' AND story_website = '$website' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') OR story_main = '1' AND story_website = '0' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC LIMIT $blocks[website_newsmax]");

and add:

                $news = mysql_num_rows($result);

$news2 = round($news/2);
$news++;

Find:

                    if (!$newsrow)

{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$newsrow = 2;
}

$mainnews .= GetTemplate("news_col_news");

if ($newsrow == 2)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}

and replace with:

                        if (!$newsrow)

{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == $news2)
{
$mainnews .= GetTemplate("news_col_middle");
}

$mainnews .= GetTemplate("news_col_news");
$newsrow++;

if ($newsrow == $news)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}

Now open category.php and add after:

            $result = DBQuery("SELECT * FROM esselbach_st_stories WHERE story_category = '$id' AND story_website = '$website' AND story_hook = '0' AND story_time < ('$currentdate') OR story_category = '$id' AND story_website = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC LIMIT 20");

the following:

                $news = mysql_num_rows($result);

$news2 = round($news/2);
$news++;

Then replace:

                        if (!$newsrow)

{
$categorynews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$categorynews .= GetTemplate("news_col_middle");
$newsrow = 2;
}

$categorynews .= GetTemplate("news_col_news");

if ($newsrow == 2)
{
$categorynews .= GetTemplate("news_col_footer");
$newsrow = 0;
}

with:

                        if (!$newsrow)

{
$categorynews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == $news2)
{
$categorynews .= GetTemplate("news_col_middle");
}

$categorynews .= GetTemplate("news_col_news");
$newsrow++;

if ($newsrow == $news)
{
$categorynews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
1 Re: 2 columns layout for news
avatar
Administrator
1340
From: Vienna, Austria
2 columns layout for news

The example I posted work only with 20 news stories, but I will look into in tomorrow.
1 Re: 2 columns layout for news
avatar
OP 269
From: -
2 columns layout for news

I can't get it to work. I've sent you a more detailed e-mail.
1 Re: 2 columns layout for news
avatar
Administrator
1340
From: Vienna, Austria
2 columns layout for news

This would require some changes in index.php as well category.php.

You could try to replace:

                    if (!$newsrow)

{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$newsrow = 2;
}

$mainnews .= GetTemplate("news_col_news");

if ($newsrow == 2)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}

with something like this:

                    if (!$newsrow)

{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 11)
{
$mainnews .= GetTemplate("news_col_middle");
}

$mainnews .= GetTemplate("news_col_news");
$newsrow++;

if ($newsrow == 20)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}

This example should add the break (news_col_middle) before news #11 and the footer after news #20.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.