Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums How To Customised displaying of news, possible?
Hhawk
Posted on 01 Mar 2011, 13:56:18

Access: Member
Total Posts: 94
Joined: 2010-03-01

Is it possible to display some code, like a banner, after the first (latest) newsitem followed by the rest of the newsitems?

Example:

Newsitem #1 (latest news)
Some custom code, like a banner here.
Newsitem #2
Newsitem #3
Newsitem #4
Newsitem #5
etc...?

Probably it's possible, but I don't know how.

//edit #1

Also I am running into a problem. Whenever someone pressed the "read more" link, they go the full story newsitem. This is all good, however there is no back link or anything else? I just have my full website layout with the full newsitem. So if they want to go back, they have to click the navigation link of my website.

Is this normal? Maybe I have removed to much from all the templates? Cause I removed the comments section (cause I don't need or use it).

//edit #2

Well I managed to create workaround for the above, by changing the comment template to the following:

Quote:
{news}
<div class="tekstvakken_links">
<div class="tekstvakken_inhoud">
<center><a href="nieuws.php" title="terug">..ga terug</a>
</center>
</div></div>
#3264
Last edited by Hhawk at 2011-03-01 15:01:19 Reason: Added a problem...
Chris
Posted on 02 Mar 2011, 06:13:02

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Whilst this isn't something the system can do by default it is doable with a bit of hackery. If you edit index.php, around line 514~ you'll see this code

Code:
        foreach($newsdata AS $news){
            $allnews .= formatnews($template,'0',$news);
        }


Change it to


Code:
        $i = 1;
        foreach($newsdata AS $news){
            $allnews .= formatnews($template,'0',$news);
            if($i == "1"){
                $allnews .= "STUFF";
            }
            $i++;
        }


This will show "STUFF" after the first article.
#3279
Hhawk
Posted on 02 Mar 2011, 07:43:38

Access: Member
Total Posts: 94
Joined: 2010-03-01

It works. Excellent. TY.
#3280
Hhawk
Posted on 02 Mar 2011, 13:43:41

Access: Member
Total Posts: 94
Joined: 2010-03-01

I was a bit to quick by saying it works, well it works, but it's also causing some problems.

On the newspage (where all newsitems are being displayed) it works great. Managed to get the banners working without problems.

However on the main website page, where I use to show the latest / last newsitem in a small column, the banners also appear, which are ruining the page.

Any idea on how to get pass that?

Maybe it's better to display the banner-code after the 2nd newsitem? So it won't show up on the main page, but only on the newsitems page?

//update

I think I may have fixed it myself, or at least make the banners show after the 2nd newsitem instead. I changed to the code to:

Code:
    $newsdata = DataAccess::fetch($sql);
    if(ID == "" || ID == "0" || $static){
        $template5 = '';
        $allnews = '';
        $oneortwo = 'one';
        $i = 1;
        foreach($newsdata AS $news){
            $allnews .= formatnews($template,'0',$news);
            if($i == "2"){
                $numsbo=3;
                $sbofiles[]="./includes/banner1.php";
                $sbofiles[]="./includes/banner2.php";
                $sbofiles[]="./includes/banner3.php";
                $option=rand(0,$numsbo-1);
                $allnews .= file_get_contents($sbofiles[$option]);
            }
            $i++;
        }


I changed the original: if($i == "1"){
into: if($i == "2"){

Is this correct coding?
#3281
Last edited by Hhawk at 2011-03-02 13:46:23 Reason: Update
Network-13.com © 2013