Nu pot sa inlcud dintr-o pagina in alta
Bun. Incerc sa fiu cat mai explicit, poate, poate ma ajuta si pe mine cineva.
Folosesc un script de anunturi. In directorul principal am fisiere php, index.php, latest-ads.php, recent-ads.php, etc + folderele pentru include, module, template, etc. In folderul template am ca si in folderul principal fisierele index, latest, recent, etc doar ca sunt in fisiere html. Acum ce vreau eu sa fac... ma duc in template, in pagina recent-ads.html iau tot ce e acolo si pun in index.html, dar nu-mi genereaza codul. De fapt mi-l genereza dar imi spune ca nu sunt anunturi :| De ce ? Banuiesc ca problema e in fisierele php din directorul principal. Imi poate spune si mie cineva, ce anume nu ma lasa sa pun codul din pagina recent-ads.html in index.html ?
index.php
Cod PHP:
<?php
require_once "include/include.php";
require_once "classes/pictures.php";
global $db;
global $lng;
$smarty = new Smarty;
$smarty = common($smarty);
$smarty->assign("lng",$lng);
$smarty->assign("section","firstpage");
if(isset($_GET['category']) && is_numeric($_GET['category'])) $cat = $_GET['category']; else $cat = 0;
$categ = new categories();
$crt_category=$categ->getName($cat);
$smarty->assign("crt_category",$crt_category);
global $appearance_settings;
//_print_r($_SESSION);
if($cat == 0) {
// first page content
$cp = new custom_pages();
$content = $cp->getFirstPageContent();
$smarty->assign("content",$content);
}
// featured ads
global $ads_settings;
$max_featured = $ads_settings['no_featured'];
$listings=new listings();
$featured = $listings->getFeatured($max_featured);
$no_featured = count($featured);
$smarty->assign("no_featured",$no_featured);
$smarty->assign("featured",$featured);
// latest ads
$max_latest = $ads_settings['no_latest'];
$latest = $listings->getLatest($max_latest);
$no_latest = count($latest);
if($ads_settings['no_latest_on_row']) $width_latest = (100/$ads_settings['no_latest_on_row']); else $width_latest=100;
if($ads_settings['no_featured_on_row']) $width_featured = (100/$ads_settings['no_featured_on_row']); else $width_featured=100;
$smarty->assign("no_latest",$no_latest);
$smarty->assign("width_latest",$width_latest);
$smarty->assign("width_featured",$width_featured);
$smarty->assign("latest",$latest);
$array_categories = $categ->getCategories($cat);
//_print_r($array_categories);
$no_categories=count($array_categories);
$no_cats_per_row=$appearance_settings["max_cat_per_row"];
$width = (int)(100/$no_cats_per_row);
$no_rows=ceil($no_categories/$no_cats_per_row);
$smarty->assign('array_categories',$array_categories);
$smarty->assign('no_categories',$no_categories);
$smarty->assign('width',$width);
$smarty->assign('no_cats_per_row',$no_cats_per_row);
$smarty->assign('no_rows',$no_rows);
// tag cloud
if(in_array("tag_cloud", $modules_array)) {
require_once $config_abs_path."/modules/tag_cloud/classes/tag_cloud.php";
$tc = new tag_cloud();
$tag_cloud_title = $tc->getTitle();
$tag_cloud_array = $tc->getTags();
$smarty->assign('tag_cloud_title',$tag_cloud_title);
$smarty->assign('tag_cloud_array',$tag_cloud_array);
}
// browse_location
if(in_array("browse_location", $modules_array)) {
require_once $config_abs_path."/modules/browse_location/classes/browse_location.php";
$bl = new browse_location();
$browse_location_settings = $bl->getSettings();
$bl_locations = $bl->getBrowseValues($browse_location_settings['type'], $browse_location_settings['field_id'], $browse_location_settings['no_rows']);
$smarty->assign('browse_location_settings',$browse_location_settings);
$smarty->assign('bl_locations',$bl_locations);
}
// browse_make
if(in_array("browse_make", $modules_array)) {
require_once $config_abs_path."/modules/browse_make/classes/browse_make.php";
$bm = new browse_make();
$browse_make_settings = $bm->getSettings();
$bm_makes = $bm->getBrowseValues($browse_make_settings['type'], $browse_make_settings['field_id'], $browse_make_settings['no_rows']);
$smarty->assign('browse_make_settings',$browse_make_settings);
$smarty->assign('bm_makes',$bm_makes);
}
// news module
if(in_array("news", $modules_array)) {
require_once $config_abs_path."/modules/news/classes/news.php";
$newsm = new news();
$news_settings = $newsm->getSettings();
$news = $newsm->getNews(1, $news_settings['news_on_first_page']);
$smarty->assign('news_settings',$news_settings);
$smarty->assign('news',$news);
// include language file
global $config_abs_path;
$lang_file = $config_abs_path."/modules/news/lang/$crt_lang.php";
if(!file_exists($lang_file)) $lang_file = $config_abs_path."/modules/news/lang/eng.php";
require_once $lang_file;
$smarty->assign("lng_news",$lng_news);
}
$db->close();
if($db->error!='') { $db_error = $db->getError(); $smarty->assign('db_error',$db_error); }
$smarty->display('index.html');
close();
?>
recent-ads.php
Cod PHP:
<?php
require_once "include/include.php";
require_once "classes/packages.php";
require_once "classes/pictures.php";
require_once "classes/paginator.php";
global $db;
global $lng;
$smarty = new Smarty;
$smarty = common($smarty);
$smarty->assign("lng",$lng);
$smarty->assign("section","recent");
$array_order_way= array("asc", "desc");
$array_order= array("date_added", "price", "title");
if(isset($_GET['page']) && is_numeric($_GET['page'])) $page=$_GET['page']; else $page=1;
if(isset($_GET['order']) && in_array($_GET['order'],$array_order)) $order=$_GET['order']; else $order='date_added';
if(isset($_GET['order_way']) && in_array($_GET['order_way'],$array_order_way)) $order_way=$_GET['order_way']; else $order_way='desc';
global $appearance_settings;
$ads_per_page=$appearance_settings["ads_per_page"];
$listings=new listings();
$no_listings=$listings->getNoRecent();
$paginator = new paginator();
$paginator->setItemsNo($no_listings);
global $seo_settings;
$paginator->paginate($smarty);
$listings_array=$listings->getRecent($page, $ads_per_page, $order, $order_way);
$smarty->assign("listings_array",$listings_array);
$smarty->assign("no_listings",$no_listings);
// favorites array
$fav_array = $listings->getFavouritesArray();
$smarty->assign("fav_array",$fav_array);
$db->close();
if($db->error!='') { $db_error = $db->getError(); $smarty->assign('db_error',$db_error); }
$smarty->display('recent_ads.html');
close();
?>
Sper sa-mi dati si mie o rezolvare ca am mai incercat si in alta parte... :| Multumesc
--- Later Edit --- (ca mi-a fost lene sa apas "Edit")
Am rezolvat :D