Forums

link template/php files within custom view

francosdad 31 Mar, 2016
Hello guys,

Is there a proper way to add files to the output (FrontList -> List display -> custom)?
I would like to better structure some of the code and also allow users to pick certain
layouts for the list I output.

in this use case the view is a calendar month view and additionally I'd like to add a Gant like view
as well.

The standard boxes in CC do not have a proper syntax highlighting and so on which makes it harder to create something more complex.
GreyHead 31 Mar, 2016
Hi jackprince,

I've never seen this question before - the boxes accept PHP so I guess that you could include files in there. I routinely do that in ChronoForms.

Bob
francosdad 31 Mar, 2016
Answer
I originally used the forms and connections but kept going to increase features which where needed.

I managed to do what I asked.


<?php
$app = JFactory::getApplication();

// include file 
   include('.'.DS.'templates'.DS.$app->getTemplate().DS.'custom'.DS.'views'.DS.'month.php');
// instantiate the class
   $month_view = new calendar_view_month;
   $month_view->draw_calendar(date('m'),date('Y'),$this->view->vars['rows'])

//same for another view
   include('.'.DS.'templates'.DS.$app->getTemplate().DS.'custom'.DS.'views'.DS.'gantt.php');
   $gantt_view = new calendar_view_gantt;
   $gantt_view->output();
?>


I created specific folders in my template to place the files which I need for this project.

You may already see that I basically use CC only as a cheer foundation here. Most of the work will be done in custom classes.
This topic is locked and no more replies can be posted.