Fix data
This commit is contained in:
+63
-52
@@ -13,70 +13,82 @@ class Home extends BaseController
|
|||||||
return view('welcome_message');
|
return view('welcome_message');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function home2(){
|
public function home2()
|
||||||
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
return $this->sitePage("home", $data);
|
return $this->sitePage("home", $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function sitePage($curr_page, $data){
|
private function sitePage($curr_page, $data)
|
||||||
return view('main/header').view('main/home').view('main/footer');
|
{
|
||||||
|
return view('main/header') . view('main/home') . view('main/footer');
|
||||||
}
|
}
|
||||||
public function home(){
|
|
||||||
|
|
||||||
$siteData =[];
|
public function home()
|
||||||
$out = $this->APIcall('GET','https://blogdata.chiefsoft.net/blogdata/chiefsoft',[]); // https://blogdata.chiefsoft.net/
|
{
|
||||||
|
|
||||||
|
$siteData = [];
|
||||||
|
$out = $this->APIcall('GET', 'https://blogdata.chiefsoft.net/blogdata/chiefsoft', []); // https://blogdata.chiefsoft.net/
|
||||||
$siteData['blogdata'] = $out['payload']['blogdata'];
|
$siteData['blogdata'] = $out['payload']['blogdata'];
|
||||||
|
|
||||||
$data=array();
|
$data = array();
|
||||||
|
|
||||||
$data["blog_featured"] = $siteData['blogdata'][0];
|
$data["blog_featured"] = $siteData['blogdata'][0];
|
||||||
$data["blog_array"] =array_slice( $siteData['blogdata'], 0, 7); // $siteData['blogdata'];
|
$data["blog_array"] = array_slice($siteData['blogdata'], 0, 7); // $siteData['blogdata'];
|
||||||
|
|
||||||
|
|
||||||
return view('site/home', $data);
|
return view('site/home', $data);
|
||||||
}
|
}
|
||||||
public function about(){
|
|
||||||
$data=array();
|
public function about()
|
||||||
$this->renderSitePage('about',$data);
|
{
|
||||||
|
$data = array();
|
||||||
|
$this->renderSitePage('about', $data);
|
||||||
}
|
}
|
||||||
public function services(){
|
|
||||||
$data=array();
|
public function services()
|
||||||
$this->renderSitePage('services',$data);
|
{
|
||||||
|
$data = array();
|
||||||
|
$this->renderSitePage('services', $data);
|
||||||
}
|
}
|
||||||
public function contact(){
|
|
||||||
$data=array();
|
public function contact()
|
||||||
$this->renderSitePage('contact',$data);
|
{
|
||||||
|
$data = array();
|
||||||
|
$this->renderSitePage('contact', $data);
|
||||||
}
|
}
|
||||||
public function blog(){
|
|
||||||
$data=array();
|
|
||||||
$this->db = \Config\Database::connect($this->con_name);
|
|
||||||
|
|
||||||
try {
|
public function blog()
|
||||||
$mysql = "SELECT id, post_title, post_content,post_date,comment_count FROM wp_posts WHERE post_type='post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 9";
|
{
|
||||||
|
$data = array();
|
||||||
|
// $this->db = \Config\Database::connect($this->con_name);
|
||||||
$mysql = "SELECT p1.id AS id, p1.*, wm2.meta_value FROM wp_posts p1 LEFT JOIN wp_postmeta wm1
|
//
|
||||||
ON (wm1.post_id = p1.id AND wm1.meta_value IS NOT NULL AND wm1.meta_key = '_thumbnail_id' )
|
// try {
|
||||||
LEFT JOIN
|
// $mysql = "SELECT id, post_title, post_content,post_date,comment_count FROM wp_posts WHERE post_type='post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 9";
|
||||||
wp_postmeta wm2
|
//
|
||||||
ON (wm1.meta_value = wm2.post_id AND wm2.meta_key = '_wp_attached_file' AND wm2.meta_value IS NOT NULL )
|
//
|
||||||
WHERE
|
// $mysql = "SELECT p1.id AS id, p1.*, wm2.meta_value FROM wp_posts p1 LEFT JOIN wp_postmeta wm1
|
||||||
p1.post_status='publish'
|
// ON (wm1.post_id = p1.id AND wm1.meta_value IS NOT NULL AND wm1.meta_key = '_thumbnail_id' )
|
||||||
AND p1.post_type='post'
|
// LEFT JOIN
|
||||||
ORDER BY p1.post_date DESC LIMIT 9";
|
// wp_postmeta wm2
|
||||||
|
// ON (wm1.meta_value = wm2.post_id AND wm2.meta_key = '_wp_attached_file' AND wm2.meta_value IS NOT NULL )
|
||||||
|
// WHERE
|
||||||
|
// p1.post_status='publish'
|
||||||
$query = $this->db->query($mysql);
|
// AND p1.post_type='post'
|
||||||
|
// ORDER BY p1.post_date DESC LIMIT 9";
|
||||||
$row = $query->getResultArray();
|
//
|
||||||
// print_r( $row );
|
//
|
||||||
// $r = $this->db->query($mysql);
|
//
|
||||||
$data["blog_array"] = $row;
|
// $query = $this->db->query($mysql);
|
||||||
} catch (Exception $ex) {
|
//
|
||||||
|
// $row = $query->getResultArray();
|
||||||
}
|
// // print_r( $row );
|
||||||
|
// // $r = $this->db->query($mysql);
|
||||||
|
// $data["blog_array"] = $row;
|
||||||
|
// } catch (Exception $ex) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
// featured
|
// featured
|
||||||
try {
|
try {
|
||||||
@@ -89,21 +101,20 @@ class Home extends BaseController
|
|||||||
// $r = $this->db->query($mysql);
|
// $r = $this->db->query($mysql);
|
||||||
$data["blog_featured"] = $rowF[0];
|
$data["blog_featured"] = $rowF[0];
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$siteData =[];
|
$siteData = [];
|
||||||
$out = $this->APIcall('GET','https://blogdata.chiefsoft.net/blogdata/chiefsoft',[]); // https://blogdata.chiefsoft.net/
|
$out = $this->APIcall('GET', 'https://blogdata.chiefsoft.net/blogdata/chiefsoft', []); // https://blogdata.chiefsoft.net/
|
||||||
$siteData['blogdata'] = $out['payload']['blogdata'];
|
$siteData['blogdata'] = $out['payload']['blogdata'];
|
||||||
|
|
||||||
$data=array();
|
$data = array();
|
||||||
|
|
||||||
$data["blog_featured"] = $siteData['blogdata'][0];
|
$data["blog_featured"] = $siteData['blogdata'][0];
|
||||||
$data["blog_array"] =array_slice( $siteData['blogdata'], 0, 7); // $siteData['blogdata'];
|
$data["blog_array"] = array_slice($siteData['blogdata'], 0, 7); // $siteData['blogdata'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->renderSitePage('blog',$data);
|
$this->renderSitePage('blog', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user