Jump to content

thalhah

Member
  • Posts

    1
  • Joined

  • Last visited

About thalhah

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

thalhah's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. Hi, I create my own sitemap.xml for WHMCS Knowledgebase. here's the code. <?php // ####################### SET WHMCS ENVIRONMENT ######################## use WHMCS\ClientArea; define('CLIENTAREA', true); require_once("init.php"); require_once("includes/functions.php"); require_once("includes/clientareafunctions.php"); // ######################### CONNECT TO DATABASE ######################## $db = mysqli_connect($db_host, $db_username, $db_password, $db_name); if (mysqli_connect_errno()) { echo "Failed to connect to Database: " . mysqli_connect_error(); } $sql_whmcs = mysqli_query($db,"SELECT * FROM tblconfiguration WHERE setting='SystemURL' LIMIT 1"); $rlt_whmcs = mysqli_fetch_array($sql_whmcs); $CFG["siteurl"] = substr($rlt_whmcs["value"], 0, -1); header('Content-Type: application/xml; charset=utf-8'); echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n"; $result = mysqli_query($db,"SELECT * FROM tblknowledgebase"); while ($data = mysqli_fetch_array($result)) { $title = str_replace(array(' ','/'), '-', $data['title']); $title = str_replace(array('?','.','[',']','"'), '', $title); echo '<url>'."\n"; echo '<loc>'.$CFG["siteurl"].'/knowledgebase/'.$data['id'].'/'.$title.'.html'.'</loc>'."\n"; echo '</url>'."\n"; }//while echo '</urlset>'."\n"; ?>
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated