سلام دوستان عزیز
جهت راه اندازی سایت برای سایتم یه فایل php نیاز دارم که نوشته شده و دقیق کار میکنه مشکلی نداره
که فایلشو زمیمیه میکنم
بعد سایت مپ چون باید xml باشه وبتونه محتوای تاون پی اچ پی رو در خودش نشون بده مشکل دارم و نمیدونم محتوای xml چی باید باشه سرچ هم زدم خیلی گشتم ولی بی فایده بود چون در همه سایت ها یا ابزار آنلاین معرفی کردن و یا این اسکلت xml سایت های استاتیک و گذاشتن
دوستان من سه تا فایل برای این کار در سایت دارم که دو تاش کامله و بی نقصه
1. googlemap.php
2. class_googlemap.php
گوگل مپ php خوب اجرا میشه
اگر دوستان کسی هست که بتونه محتوای sitemap.xml و بنویسه یا راهنمایی کنه لطفا خبر بده
تلگرام آی دی من @toopmusics
اگه شرایطی هم داشت بفرمایید ممنونم زود تر جواب بدید لنگ اینم
این کد های فایل googlemap.php
کد PHP:
<?session_start();ob_start( );include('include/config.php');include('include/function_add.php');include('include/function_main.php');include('include/function_time.php');include('include/class_db.php');header('Content-Type: text/xml');
$my_config_q = $class_db->sql_query("SELECT * FROM `".dbperfix."config` ");$my_config_r = $class_db->sql_fetchrow( $my_config_q );
include_once('include/class_googlemap.php'); $map = new googlemap($config);
$map->limit = intval($class_db->undo_escape($my_config_r['googlemap_limit'])); $map->news_priority = strip_tags(stripslashes( $class_db->undo_escape($my_config_r['googlemap_priority']) )); $map->stat_priority = strip_tags(stripslashes($class_db->undo_escape($my_config_r['googlemap_stat_priority']))); $map->cat_priority = strip_tags(stripslashes($class_db->undo_escape($my_config_r['googlemap_cat_priority']))); $sitemap = $map->build_map(); $handler = fopen("sitemap.xml", "wb+"); fwrite($handler, $sitemap); fclose($handler); print $sitemap;
ob_end_flush();?>
اینم کد های فایل کلاس class_googlemap.php
کد PHP:
<?php//mohsen davariclass googlemap{
var $home = patch_url; var $limit = 10; var $news_priority = "0.5"; var $stat_priority = "0.5"; var $priority = "0.6"; var $cat_priority = "0.7";
function googlemap () {
} function build_map () {
$map = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n"; $map .= $this->get_static(); $map .= $this->get_categories(); $map .= $this->get_news(); $map .= "</urlset>";
return $map;
}
function get_categories() { global $class_db;
global $db;
$this->priority = $this->cat_priority;
if (!is_array($cat_info)) { $cat_info = array ();
$my_sql_info = $class_db->sql_query("SELECT * FROM `".dbperfix."advertisement_cat` where `parentid`='0' ORDER BY `id` DESC"); $n=0; while($my_sql_info_r = $class_db->sql_fetchrow( $my_sql_info ) ){
$cat_info[$my_sql_info_r['id']] = array ();
foreach ($my_sql_info_r as $key => $value) { $cat_info[$my_sql_info_r['id']][$key] = $value; }
}
}
$xml = ""; $lastmod=date("Y-m-d");
foreach ($cat_info as $cats) { $loc = $this->home."/".$cats['id']."/index.html";
$xml .= $this->get_xml($loc, $lastmod); }
return $xml; }
function get_news() {
global $class_db;
$xml = ""; $this->priority = $this->news_priority;
if ($this->limit < 1) $this->limit = false;
if ($this->limit) {
$this->limit = " LIMIT 0,".$this->limit;
} else {
$this->limit = "";
}
$my_sql_info = $class_db->sql_query("SELECT * FROM `".dbperfix."advertisement_pocket_image` where `state`='1' ORDER BY `id` DESC ".$this->limit .""); $n=0; while($my_sql_info_r = $class_db->sql_fetchrow( $my_sql_info ) ){
$loc = $this->home.'/'.$my_sql_info_r['advertisement_catid'].'/advertisementpocketimage_show/'.$my_sql_info_r['id'].'/info.html'; $xml .= $this->get_xml($loc, date("Y-m-d", $my_sql_info_r['date'])); }
return $xml; } function get_static() {
global $class_db;
$xml = ""; $lastmod=date("Y-m-d");
$this->priority = $this->stat_priority;
$my_sql_info = $class_db->sql_query("SELECT * FROM `".dbperfix."page` ORDER BY `id` DESC ".$this->limit .""); $n=0; while($my_sql_info_r = $class_db->sql_fetchrow( $my_sql_info ) ){
$loc = $this->home.'/0/'.$class_db->undo_escape($my_sql_info_r['url']).'.html';
$xml .= $this->get_xml($loc, $lastmod); }
return $xml; }
function get_xml($loc, $lastmod){
$loc = htmlspecialchars($loc);
$xml = "\t<url>\n"; $xml .= "\t\t<loc>$loc</loc>\n"; $xml .= "\t\t<lastmod>$lastmod</lastmod>\n"; $xml .= "\t\t<priority>".$this->priority."</priority>\n"; $xml .= "\t</url>\n";
return $xml; }
}
?>
sitemap.xml چی باید باشه؟