Diload Posted May 17, 2010 Share Posted May 17, 2010 Hey I used the show announcements scripts on my frontpage of my site and wanted to link to my site but didn't work since I used seo friendly url's so here is my solution to it with some php regex. <?php include("billing/dbconnect.php"); include("billing/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 = $data["announcement"]; $date = fromMySQLDate($date); /*THIS IS IT ! */ $link = preg_replace("/[^a-zA-z0-9\s\+]/", "", $title); $link = preg_replace("/[\+]/", "plus", $link); $link = preg_replace("/[\s]/", "-", $link); echo("<p><a style=\"text-decoration: none;\" href=\"billing/announcements/$id/$link.html\"><font color=#cccccc>$date</font> - <font color=#000000><b>$title</b></font></a><br>$announcement</p>"); } ?> (Billing is just where my WHMCS lives on my server correct it to where it is on your server) 0 Quote Link to comment Share on other sites More sharing options...
bullfrog3459 Posted May 29, 2010 Share Posted May 29, 2010 Hey I used the show announcements scripts on my frontpage of my site and wanted to link to my site but didn't work since I used seo friendly url's so here is my solution to it with some php regex. <?php include("billing/dbconnect.php"); include("billing/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 = $data["announcement"]; $date = fromMySQLDate($date); /*THIS IS IT ! */ $link = preg_replace("/[^a-zA-z0-9\s\+]/", "", $title); $link = preg_replace("/[\+]/", "plus", $link); $link = preg_replace("/[\s]/", "-", $link); echo("<p><a style=\"text-decoration: none;\" href=\"billing/announcements/$id/$link.html\"><font color=#cccccc>$date</font> - <font color=#000000><b>$title</b></font></a><br>$announcement</p>"); } ?> (Billing is just where my WHMCS lives on my server correct it to where it is on your server) Awesome! I love it, was just actually what i needed for my new site I'm in the works developing!! 0 Quote Link to comment Share on other sites More sharing options...
Brainchild Labs Pty Ltd Posted November 8, 2011 Share Posted November 8, 2011 Does this work in the latest version of whmcs 4.5.2 ? Also is this code meant to be for the client portal or can it be inserted into wordpress as a widget and it also shows the annoucements ? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.