Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Forking layouts, calling original from forked 05 Jul 2013 17:48 #7885

I am forking a layout for a view. Is is possible to call the original file from within the forked file. So for example I have:
./views/employees/default.php

and
./fork/views/employees/default.php

Inside ./fork/views/employees/default.php I want to load ./views/employees/default.php, and then add some other stuff it before echoing it out to be displayed.

Thanks.

Please Log in or Create an account to join the conversation.

Forking layouts, calling original from forked 06 Jul 2013 08:05 #7893

  • BTB300
  • BTB300's Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 415
  • Thank you received: 132
Copy your original default.php to the fork file (its just a mirror of the original directory)
copy your default.php from the
views/tmpl directory 
to
 fork/views/tmpl directory 
(if the tmpl directory is not there create it)
look for the call to your template in your default.php
		<div>

			<!-- BRICK : grid -->
			<?php echo $this->loadTemplate('grid'); ?>
		</div>

if you want to call another view as well as and the original copy it to to the tmpl directory in the fork

in the fork directory lets say i have 3 templates
myview.php
myview_grid_header.php
myview_grid.php
myview_grid_footer.php

editing your default.php in the fork tmpl directory like this will load all three views from the fork directory
		<div>

			<!-- BRICK : grid_header -->
			<?php echo $this->loadTemplate('grid_header'); ?>
          
                       <!-- BRICK : grid -->
			<?php echo $this->loadTemplate('grid'); // your original view ?>

                      <!-- BRICK : grid_footer-->
			<?php echo $this->loadTemplate('grid_footer'); ?>

		</div>

Got it now?

BTW if you want to see the changes in your original myview_grid.php
dont copy it to the fork directory and it will load your original from the views/tmpl directory

so your fork directory would look like this
myview.php
myview_grid_header.php
myview_grid_footer.php

And your views/tmpl looks like this
myview.php <- changes to this file are not loaded as there is a file with the same name in the fork
myview_grid is loaded from the original <- changes to this file are reflected in the output because there is not a copy in the fork
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Last edit: by BTB300.

Forking layouts, calling original from forked 07 Jul 2013 12:20 #7901

  • etc
  • etc's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 132
  • Thank you received: 19
Is it possible to put files from images and css folder to fork directory as well?

Please Log in or Create an account to join the conversation.

Forking layouts, calling original from forked 07 Jul 2013 12:55 #7903

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Yes.

Css are loaded AFTER your component css, so you can override it.
From the CSS you lad the forked images. (../images/xxxxxx.png)
Coding is now a piece of cake
The following user(s) said Thank You: etc

Please Log in or Create an account to join the conversation.

Forking layouts, calling original from forked 08 Jul 2013 16:36 #7913

I understand how to move files to the fork directory.

Specifically though, I want to be able to call my original default.php from inside the forked default.php You didn't really say whether or not that is possible.

In this way, any updates I make to the original by using j-cook will still be be displayed without me having to update the forked default.php.

Is this specific ability possible? If not, It would be great to have a function to do that.

Thank you.

Please Log in or Create an account to join the conversation.

Forking layouts, calling original from forked 10 Jul 2013 20:47 #7930

  • BTB300
  • BTB300's Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 415
  • Thank you received: 132

BTB300 wrote:
BTW if you want to see the changes in your original myview_grid.php
dont copy it to the fork directory and it will load your original from the views/tmpl directory

so your fork directory would look like this
myview.php
myview_grid_header.php
myview_grid_footer.php

And your views/tmpl looks like this
myview.php <- changes to this file are not loaded as there is a file with the same name in the fork
myview_grid is loaded from the original <- changes to this file are reflected in the output because there is not a copy in the fork


myview.php calls the other templates
put myview.php in your fork file and it will call your updated template from the standard directory
when you overwrite your component (install over the top) the fork file is left untouched

sorry i didnt explain it better last time

Please Log in or Create an account to join the conversation.

Forking layouts, calling original from forked 11 Jul 2013 17:47 #7934

I understood your explanation fine. I don't think you are grasping what it is I want to do.

I have /fork/views/employees/tmpl/default.php

I want to include the content from /views/employees/tmpl/default.php FROM INSIDE /fork/views/employees/tmpl/default.php.

I want to do this without copying and pasting the content from the original into the forked. In this way, changes to the original will propagate to my component without me having to copy and paste every time I update.

This has nothing to do with the default_grid.php or default_filters.php

I think what you are telling me is that it's not possible...

Here is an example:

/views/employees/tmpl/default.php contains the following:
<?php
defined('_JEXEC') or die('Restricted access');
ChronosHelper::headerDeclarations();
?>

<h2><?php echo $this->title;?></h2>
<form action="<?php echo(JRoute::_("index.php")); ?>" method="post" name="adminForm" id="adminForm">
	<div>
		<div>

			<!-- BRICK : toolbar_plur -->
			<?php echo JDom::_('html.toolbar', array(
				"bar" => JToolBar::getInstance('toolbar')
			));?>
		</div>
		<div>

			<!-- BRICK : filters -->
			<div class="pull-left">
				<?php if ($this->canDo->get('core.edit.state')): ?>
					<?php echo $this->filters['filter_published']->input;?>
				<?php endif; ?>

			</div>
			<div class="pull-left">
				<?php echo $this->filters['filter_facility']->input;?>
			</div>
			<div class="pull-left">
				<?php echo $this->filters['filter_position']->input;?>
			</div>
			<div class="pull-right">
				<?php echo $this->filters['limit']->input;?>
			</div>
			<div class="pull-right">
				<?php echo $this->filters['directionTable']->input;?>
			</div>
			<div class="pull-right">
				<?php echo $this->filters['sortTable']->input;?>
			</div>
			<div class="clearfix"></div>
			<div class="pull-right">
				<?php echo $this->filters['search_search_name']->input;?>
			</div>

		</div>
		<div>

			<!-- BRICK : grid -->
			<?php echo $this->loadTemplate('grid'); ?>
		</div>
		<div>

			<!-- BRICK : pagination -->
			<?php echo $this->pagination->getListFooter(); ?>
		</div>
	</div>


	<?php 
		$jinput = JFactory::getApplication()->input;
		echo JDom::_('html.form.footer', array(
		'values' => array(
					'view' => $jinput->get('view', 'employees'),
					'layout' => $jinput->get('layout', 'default'),
					'boxchecked' => '0',
					'filter_order' => $this->escape($this->state->get('list.ordering')),
					'filter_order_Dir' => $this->escape($this->state->get('list.direction'))
				)));
	?>
</form>


/fork/views/employees/tmpl/default.php would contain this:
<?php
defined('_JEXEC') or die('Restricted access');
?>
.. some function call to include the original default.php for example ...
<?php echo $this->loadOriginalTemplate('default'); ?>

<div>This div will display AFTER the original default.php content. Any changes to the original default.php will be displayed on this page. I can update the original , and the changes will be displayed, along with this additional content.</div>

Please Log in or Create an account to join the conversation.

Forking layouts, calling original from forked 11 Jul 2013 22:14 #7936

To further clarify what I am asking, you gave this response:

And your views/tmpl looks like this
myview.php <- changes to this file are not loaded as there is a file with the same name in the fork
myview_grid is loaded from the original <- changes to this file are reflected in the output because there is not a copy in the fork


What I want:

And your views/tmpl looks like this
myview.php <- changes to this file are loaded because I told the forked file to load this file
myview_grid is loaded from the original <- changes to this file are reflected in the output because there is not a copy in the fork


I'm going to go ahead and assume this isn't possible as it stands (correct me if I am wrong). It would be a great feature for the next release.

Please Log in or Create an account to join the conversation.

Forking layouts, calling original from forked 12 Jul 2013 05:46 #7938

  • etc
  • etc's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 132
  • Thank you received: 19
Hi,

it seems to me you are trying to use fork in different way than it was designed
The following user(s) said Thank You: jhallock

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.076 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started