HTML sitemapI like to change the way to view the sitemap as tree of page link like one given below.[list]Document root [list]Home page About Contact Web hosting [list]Free hosting Paid hosting[/list:u] Domain name [list]Free domain Cheap domain [list]Dot com Dot info Dot net[/list:u][/list:u][/list:u][/list:u] Is there any way to get it? Please give step by step sol. |
| Posted by: kuljeet; Post:1; Comments:0; Date of Join: Jul 25, 2011, 05:00 Post date: Jul 25, 2011, 05:07 |
| New topicReplyContactReport |
Re: HTML sitemapYes, it is very much possible. But I need few more time. Please come back after 3 to 4 days. I'm doing it for you.----------------------------------------------------------- |
| Posted by: admin; Post:34; Comments:116; Date of Join: Nov 05, 2008, 08:04 Post date: Jul 26, 2011, 14:20 |
| ContactReport |
HTML Sitemap T-structureHello,Here is your solution. Please follow the steps below. 1. Open file /fw_blog/include/clsdatabase.php for editing. 2. At the end of the file just before the ‘}’ bracket add the following three functions. Code private function arrange(&$array,$folder)
{
$str='';
foreach($array as $key => $item)
{
if(!is_array($item)){$str.=$item;}
else{
$str.='<li><a href="http://'.getenv('HTTP_HOST').fw_get_docroot().$folder.'/'.$key.'/index.html">'.$key.'</a><ul>';
$str.=$this->arrange($item,$folder.'/'.$key);}
}
$str.='</ul></li>';
return $str;
}
private function fw_list_item(&$parent,$item,$title,$pagename)
{
$pos=strpos($item,'/');
if($pos===false){$parent[]='<li><a href="http://'.getenv('HTTP_HOST'). fw_get_docroot().$pagename.'.html">'.$title.'</a></li>'; return;}
else{
$dir=substr($item,0,$pos);
$newitem=substr($item,$pos+1);
if(!array_key_exists($dir,$parent)){$parent[$dir]=array();}
$this->fw_list_item($parent[$dir],$newitem,$title,$pagename);
}
}
public function get_sitemap()
{
$folders=array();
$docroot='';
$query="SELECT pagename, title FROM ".$this->prefix. "postinf WHERE publish = 1 AND addtomenu = 1 ORDER BY date DESC LIMIT 0,300";
$result = @mysql_query($query);
while($row = @mysql_fetch_array($result, MYSQL_ASSOC))
{
if(($pos=strpos($row['pagename'],'/'))===false){$docroot.='<li><a href="http://'.getenv('HTTP_HOST'). fw_get_docroot(). $row['pagename'].'.html">'.$row['title'].'</a></li>';}
else{$this->fw_list_item ($folders,$row['pagename'],$row['title'],$row['pagename']);}
}
foreach($folders as $key => $f){
$sitemap.='<li><a href="http://'.getenv('HTTP_HOST'). fw_get_docroot().$key.'/index.html">'.$key.'</a><ul>';
$sitemap.=$this->arrange($f,$key);}
if(!empty($docroot)){$sitemap='<li>'.$docroot.'</li>'.$sitemap;}
if($sitemap!=''){$sitemap= '<div id="fw_sitemap"><ul>'.$sitemap.'</ul></div>';}
return $sitemap;
}3. Save the file and upload it at its original position.4. Login to your admin control panel. 5. Create a new page (not post) name = ‘sitemap’; Title = ‘HTML sitemap’ Description, Keywords optional. 6. Please uncheck the ‘Add sitemap’ option. 7. At page content write the following line. Code <?php echo $fw_db->get_sitemap();?>8. Save that page and publish it. 9. If you are unable to edit file clsdatabase.php then please download it from the following attachment and replace the original one. 10. Now your sitemap will work on your way.[attachment=0]clsdatabase.php.zip[/attachment] ----------------------------------------------------------- |
| Posted by: admin; Post:34; Comments:116; Date of Join: Nov 05, 2008, 08:04 Post date: Jul 28, 2011, 07:01 |
| ContactReport |