Results 1 to 7 of 7

Thread: Cutenews help

  1. #1
    Join Date
    Oct 2008
    Location
    London
    Posts
    309
    Tokens
    0

    Default Cutenews help

    Hey does anyone know how to display the latest news published on cutenews in a box and so it auto-updates, for example www.clubhabbo.net?


  2. #2
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Yep, just use an iframe and add a refresh code at the bottom of /cutenews/show_news.php

    Refresh code:

    You can edit the 120 to whatever you like, but it means it refreshes every 120 seconds (recommended - don't want to use up bandwith when you could be saving it and you're not going to be having articles posted every minute)

    HTML Code:
    <META HTTP-EQUIV='Refresh' CONTENT='120; URL=show_news.php'>
    Iframe code:

    (Edit width/height)

    HTML Code:
    <iframe src="/cutenews/show_news.php" name="news" width="200" height="120" frameborder="0" scrolling="no" allowtransparency="true"></iframe>
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  3. #3
    Join Date
    Oct 2008
    Location
    London
    Posts
    309
    Tokens
    0

    Default

    Hey thanks, but is there a way i can make it just display the title then when they click it, it opens in main content?


  4. #4
    Join Date
    Oct 2008
    Location
    In a box, US
    Posts
    306
    Tokens
    0

    Default

    Okay, IFRAMES are so OUT-dated.
    I have an ajax solution to help you!
    edit: you have to find and download prototype.js and you can get effects from http://simplehabbo.net/effects.js
    ADD THIS TO <HEAD> section >;]
    Code:
    <script type="text/javascript" language="javascript" src="proto.js"></script>
    <script type="text/javascript" language="javascript" src="effects.js"></script>
    
    <script type="text/javascript">
    
    
                    
    
                function GetXmlHttpObject(  )
    
                {
    
                
    
                    var xmlHttp = null;
    
                    
    
                    try
    
                    {
    
    
    
                      xmlHttp = new XMLHttpRequest();
    
                    
    
                    }
    
                
    
                    catch( e )
    
                      {
    
    
    
                        try
    
                        {
    
                        
    
                            xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP" );
    
                            
    
                        }
    
                        
    
                        catch( e )
    
                        {
    
                        
    
                            xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
    
                            
    
                        }
    
                            
    
                    }
    
                      
    
                    return xmlHttp;
    
                
    
                }    
    
                
    
                function GetNews()
    
                { 
    
                
    
                    xmlHttp = GetXmlHttpObject(); 
    
                
    
                    if( xmlHttp == null )
    
                    {
    
                
    
                        alert ( "Browser does not support HTTP Request" )
    
                
    
                        return;
    
                
    
                    }
    
                
    
                    var url = "path/to/cutenews/show_news.php";
    
                
    
                    xmlHttp.open( "GET", url, true );
    
                
    
                    xmlHttp.onreadystatechange = function(  )
    
                    {
    
                
    
                        if ( xmlHttp.readyState == 4 )
    
                        { 
    
                
    
                            if ( xmlHttp.status == 200 )
    
                            {
    
            
    
                                document.getElementById( "news" ).innerHTML = xmlHttp.responseText; 
    
            
    
                            }
    
                
    
                        }
    
                
    
                    };
    
                
    
                    xmlHttp.send( null ); 
    
                
    
                }
    
                
    
                GetStats();
    
                
    
                setInterval( "GetStats()", 30000 );
    </script>
    </head>
    Change var url to ur cutenews/show news.php
    You'll have to create a div called "news" have it empty where you would like the headlines to be shown
    Change the 30000 in setInterval( "GetNews()", 30000 ); a period of time in which you want it to change.

    Now when you start the page, you wanna get the headlines right on page load so we ddo:
    Code:
    <body onLoad="GetNews();">
    ur done!
    Last edited by D-Man22; 30-10-2008 at 08:15 PM.
    █ PureHosts.com
    █ Shared, ShoutCAST, and reseller hosting.
    █
    Reasonable prices, amazing support.

    Views expressed by me through my HXF, CHF or any forum account, do not necessarily express the views or opinions of Pure Web Solutions.

  5. #5
    Join Date
    Oct 2008
    Location
    London
    Posts
    309
    Tokens
    0

    Default

    I don't understand that lmao


  6. #6
    Join Date
    Oct 2008
    Location
    London
    Posts
    309
    Tokens
    0

    Default

    Sorry to double post, please merge.

    How would I do this with php includes instead of iframes?

    Please reply.

    Thanks.


  7. #7
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default

    Quote Originally Posted by Seads View Post
    Sorry to double post, please merge.

    How would I do this with php includes instead of iframes?

    Please reply.

    Thanks.
    Put
    PHP Code:
    <?php include('pathtocutenews/show_news.php'); ?>
    where the iframes would be.
    I think that's right. I never know which type of quotes to use.
    The extension of the page has to be .php, eg index.php not index.html.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •