Welcome Guest, Not a member yet? Register   Sign In
ME HMVC, title and meta tags
#1

[eluser]Mikle[/eluser]
Hello!

I have main controller, which load my HMVC modules. Can I send title & meta tags from modules to main controller?
#2

[eluser]Johan André[/eluser]
Create a MX_Controller.php (in libraries) with a add_meta() and add_title()-method and extend your module controllers from it.
#3

[eluser]Mikle[/eluser]
[quote author="Johan André" date="1247783874"]Create a MX_Controller.php (in libraries) with a add_meta() and add_title()-method and extend your module controllers from it.[/quote]

Can you write a sample?
#4

[eluser]Mikle[/eluser]
UP
#5

[eluser]Mikle[/eluser]
I created MX_Controller, but how can I send meta tag from
modules::load()?

Here my MX_Controller:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Base Controller
*/
class Base_Controller extends Controller
{
    var $data;
    
    public function __construct(){
        parent::__construct();
        modules::load('forum/widget');
        modules::load('news/widget');
        modules::load('poll/widget');
        modules::load('tagcloud/widget');
    }
    
    function layout($tpl)
    {
        //print_r($this->data);
        $this->load->view($tpl, $this->data);
    }

    function set_title($title)
    {
        $this->data['title'] = $title;
    }

    function set_meta($keywords, $description = '')
    {
        $this->data['keywords'] = $keywords;
        $this->data['description'] = $description;
    }
    function set_content($content = '')
    {
        $this->data['content'] = $content;
    }
    
    public function _remap(){
        $module = $this->uri->segment(1) OR $module = 'home';
        $method = $this->uri->segment(2) OR $method = 'index';

        $title = $module.'/'.$method;
        //$this->set_title($title);
        $content = modules::run($module.'/'.$method);
        $this->set_content($content);
        
        $this->load->view('layout', $this->data);
    }
}
#6

[eluser]mineass[/eluser]
[quote author="Johan André" date="1247783874"]Create a MX_Controller.php (in libraries) with a add_meta() and add_title()-method and extend your module controllers from it.[/quote]

really what did u mean? can u give us real example?
#7

[eluser]Mikle[/eluser]
[quote author="mineass" date="1298741196"][quote author="Johan André" date="1247783874"]Create a MX_Controller.php (in libraries) with a add_meta() and add_title()-method and extend your module controllers from it.[/quote]

really what did u mean? can u give us real example?[/quote]
U can use my sample & extend your controllers by base_controller. Don't forget to use set_title & etc. in your controller actionsWink




Theme © iAndrew 2016 - Forum software by © MyBB