Page 2 of 6 FirstFirst 1234 ... LastLast
Results 16 to 30 of 78

Thread: Announcements on a side box on website

  1. #16
    Join Date
    Aug 2007
    Posts
    393

    Default

    Thanks - good to know your script will work on all pages.

    Thanks guys for all your work

  2. #17
    Join Date
    Jan 2008
    Location
    Ashford, Kent, UK
    Posts
    426

    Default

    This is brilliant. Saves me using an external news system and keeps a lot of my stuff in one place.

    Thanks a lot.

  3. #18
    Join Date
    Jul 2007
    Posts
    85

    Default

    this works with 3.6.0?

  4. #19
    Join Date
    Jan 2008
    Posts
    354

    Default

    Unless Matt changed the table associated with the announcements, yes, it will work. I highly doubt this was changed though.

  5. #20
    Join Date
    Jul 2007
    Posts
    85

    Default

    well my rss2html script can't pull information any more... with the previous setup I have

  6. #21
    Join Date
    Jan 2008
    Posts
    354

    Default

    Care to post the script?

  7. #22
    Join Date
    Jul 2007
    Posts
    85

    Default

    It's the free one out there... google search it.
    I've gotten in trouble for sharing links before.. so...

  8. #23
    Join Date
    Jan 2008
    Posts
    354

    Default

    That's alright, if you want to post the code I'll check it out.

  9. #24
    Join Date
    Jul 2006
    Location
    Chicago, IL
    Posts
    407

    Default

    http://www.rss2html.com/ is the script he's talking about.
    @jordanriane / mywhmcs.com
    Frontend Webdeveloper (Currently Available)

  10. #25
    Join Date
    May 2007
    Posts
    59

    Default

    Anyone get a similar error?

    News & announcements: view more'; if($x) echo '

    There are no new announcements.
    '; ?>

  11. #26
    Join Date
    May 2007
    Posts
    59

    Default

    I was able to get it working but taking from another method and coming up with this:
    Code:
    {php}
    // truncate the text to only 65 chars, add ... to the end
    function truncate($text) {
    $text = substr($text,0,200);
    $text = substr($text,0,strrpos($text,' '));
    $text = $text."...";
    return $text;
    }
    include("support/dbconnect.php");
    include("support/includes/functions.php");
    $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,3"; 
    $result = mysql_query($query);
    while ($data = mysql_fetch_array($result)) {
    $id = $data["id"];
    $date = $data["date"];
    $title = $data["title"];
    $announcement = truncate($data['announcement']);
    $date = fromMySQLDate($date);
    echo'<div style="border:solid 1px #e8e8e8; padding:5px;background-color:#f7f7f7;">'.$date.'&nbsp;-&nbsp;<strong><a href="announcements.php?id='.$id.'">'.$title.'</a></strong><p class="sfont2">
    '.$announcement.' <a href="announcements.php?id='.$id.'">...more</a></p></div><p>';
    }
    {/php}

    Of course as stated - you will need to change appropriate URLs and HTML.

  12. #27
    Join Date
    Jun 2008
    Location
    South Korea
    Posts
    11

  13. #28
    Join Date
    Feb 2009
    Posts
    40

    Default

    Excellent little snippet. Thanks alot!

  14. #29
    Join Date
    Apr 2007
    Posts
    60

    Default I tried this and get a blank page

    This sounds like a great solution however I tried it and got a blank page

    I created a page called news.php

    I posted this code:

    -----------------------------------------------------------

    <?
    $x=1; // requested edit
    // truncate the text to only 65 chars, add ... to the end
    function truncate($text) {
    $text = substr($text,0,60);
    $text = substr($text,0,strrpos($text,' '));
    $text = $text."...";
    return $text;
    }

    // format the date to mm/dd/yyyy
    function formatdate($date) {
    $year = substr ($date, 0, 4);
    $month = substr ($date, 5, 2);
    $day = substr ($date, 8, 2);
    return $month.'/'.$day.'/'.$year;
    }

    // limit the number of announcements to return
    $limit = 2;


    require '/home/trouble/public_html/billing/configuration.php';
    $link = mysql_connect($db_host,$db_username,$db_password);
    mysql_select_db($db_name);

    $result = mysql_query("SELECT * FROM tblannouncements WHERE published='on' ORDER BY id DESC LIMIT ".$limit);
    while($data = mysql_fetch_array ($result))
    {
    $id = $data['id'];
    $date = $data['date'];
    $announcement = truncate($data['announcement']);
    $date = formatdate($date);
    echo'<p><span>'.$date.'</span> - '.$announcement.' <a href="../billing/announcements.php?id='.$id.'"><img src="/images/more.gif" alt="more info" /></a></p>';
    echo'<hr />';
    $x=false;
    }
    if(!$x) echo '<p>News &amp; announcements: <a href="../billing/announcements.php">view more</a></p>';
    if($x) echo '<p>There are no new announcements.</p>';
    ?>

    ----------------------------------------------

    Am I suppose to do something with this:

    -----------------------------------------
    require '/home/user/public_html/billing/configuration.php';
    $link = mysql_connect($db_host,$db_username,$db_password);
    mysql_select_db($db_name);

    -----------------------

    Am I suppose to change out the values to match my site??

    /home/user/ - should that be something else?

    $db_host
    $db_username
    $db_password
    $db_name

    Are those suppose to be something else?

  15. #30
    Join Date
    Aug 2007
    Posts
    5

    Default

    this script works great for me on latest version 3.8.1

Page 2 of 6 FirstFirst 1234 ... LastLast

Similar Threads

  1. Replies: 2
    Last Post: 02-28-12, 06:47 AM
  2. Integrate announcements to my main website
    By Rachmat in forum Customisation & Integration Questions
    Replies: 2
    Last Post: 11-01-10, 03:29 AM
  3. Looking to have an announcements posted on main website
    By Mattg in forum Customisation & Integration Questions
    Replies: 1
    Last Post: 10-27-09, 03:28 AM
  4. right side box
    By egcsolutions in forum Customisation & Integration Questions
    Replies: 1
    Last Post: 10-12-09, 10:32 AM