0

I am pretty new to codeigniter and working on an audio cart website.

I implemented a audio playlist in my project and I created a different module called playlist. Created routes and everything working fine for the page playlist. I used HMVC codeigniter and hence i have different folders for each module.

My playlist is basically a list of songs and user can select and play any song.

 Modules-
    ---Playlist
       --Controllers
         --playlist.php (my front controller)           
       --Models 
         --playlistmodel.php (model)  
       --Views
         index.php (view for showing playlist)

Now according to new specifications, This playlist can be placed anywhere in the website. It should be working. I am not able to figure out how is this feasible ? should I need to create helpers ?

Please help .

Live Url : http://webcartz.stagetesting.com/playlist

Thanks

Sharmaji
  • 599
  • 2
  • 9
  • 23

2 Answers2

0

see this url:--

How to load a module outside modules folder on HMVC with CodeIgniter?

Well you can do this too

<?php echo Modules::run('../bar/bar/index'); ?>
Community
  • 1
  • 1
Abid Hussain
  • 7,724
  • 3
  • 35
  • 53
0

Perhaps you should create a library then

When we use the term "Libraries" we are normally referring to the classes that are located in the libraries directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create your own libraries within your application/libraries directory in order to maintain separation between your local resources and the global framework resources.

As an added bonus, CodeIgniter permits your libraries to extend native classes if you simply need to add some functionality to an existing library. Or you can even replace native libraries just by placing identically named versions in your application/libraries folder.

http://codeigniter.com/user_guide/general/creating_libraries.html

something like this

class Playlistlib {

public function __construct($params)
{
    $CI =& get_instance(); // so you'd use $CI instead of $this to ref to CI object
    // Do something with $params
}

public function get_playlist($params)
{
    // Do something with $params
}

}

$params = array('id' => 15, 'limit' => 5);

$this->load->library('Playlistlib', $params);
TigerTiger
  • 10,590
  • 15
  • 57
  • 72