LoadTemplate: Layout not found

110 views
Skip to first unread message

Jefeh

unread,
Aug 24, 2010, 5:34:48 PM8/24/10
to Joomla! General Development
Hi,
I already posted that message on the Joomla forum but unfortunately, I
received no response... So I would also ask you the question...

I try to build my first component for Joomla and I'm in front of a
problem...

Actually, I have a view which displays correctly a default
template...

Here is the source code:
<?php
defined('_JEXEC') or die ('Restricted access');
jimport( 'joomla.application.component.view');

class MyViewViewStudents extends JView {

function display($tpl = null) {
$data =& $this->get('Students');
$this->assignRef('type', JRequest::getVar('action', 'null'));
$this->assignRef('data', $data);

parent::display($tpl);
}
}
?>


The template (named default.php):
<?php
defined('_JEXEC') or die ('Restricted access');?>

<div id="tabs-wrapper">
<h2 class="container">Students</h2>
<ul class="tabs primary">
<li><a href="index.php?
option=com_scolas&view=students">Students</a></li>
<li><a href="index.php?
option=com_scolas&task=new_student_I21">New Student</a></li>
<li><a href="index.php?
option=com_scolas&task=showGrid_I21">Grid View</a></li>
</ul>
</div>


Sometimes, I have to add to my template the content of an other one.
So, the source code becomes:
<?php
defined('_JEXEC') or die ('Restricted access');?>

<div id="tabs-wrapper">
<h2 class="container">Students</h2>
<ul class="tabs primary">
<li><a href="index.php?
option=com_scolas&view=students">Students</a></li>
<li><a href="index.php?
option=com_scolas&task=new_student_I21">New Student</a></li>
<li><a href="index.php?
option=com_scolas&task=showGrid_I21">Grid View</a></li>
</ul>
</div>
<?php if($this->type != 'null') {
$this->loadTemplate($this->type);
}
?>


Unfortunately, at this times, my page is no longer displayed and I
receive an Error 500:
Quote:
Layout 'default_grid_I21' not found


However, this template is in the same directory that "default.php"...
So I don't know what is wrong and I hope you could help me...

Thanks in advance.
Jefeh

Brad Gies

unread,
Aug 24, 2010, 6:02:24 PM8/24/10
to joomla-de...@googlegroups.com

Do you need something like this?

<?php if($this->type != 'null') {

echo $this->loadTemplate($this->type);

--
Sincerely,

Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro Blurb
http://bgies.com
http://bistroblurb.com
http://ihottonight.com
http://forcethetruth.com
-----------------------------------------------------------------------

Everything in moderation, including abstinence

Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead

Ian MacLennan

unread,
Aug 24, 2010, 8:36:18 PM8/24/10
to joomla-de...@googlegroups.com
What is the name of the other file?

Ian

> --
> You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
> To post to this group, send an email to joomla-de...@googlegroups.com.
> To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.
>
>

Ian MacLennan

unread,
Aug 24, 2010, 8:37:52 PM8/24/10
to joomla-de...@googlegroups.com
What is the name of the other file?

Ian

On Tuesday, August 24, 2010, Jefeh <jfred....@gmail.com> wrote:

Jefeh

unread,
Aug 25, 2010, 2:31:26 AM8/25/10
to Joomla! General Development
I wrote
<?php if($this->type != 'null') {
echo $this->loadTemplate($this->type);

Because the content of the current page is not always the same... So
different templates have to be load according to some arguments.

The name of the other file is "default_grid_I21.php".

Azamat Tokhtaev

unread,
Aug 25, 2010, 2:41:52 AM8/25/10
to joomla-de...@googlegroups.com
try to rename the file default_grid_I21.php to default_default_grid_I21.php

2010/8/25 Jefeh <jfred....@gmail.com>



--
Life Be Good mon

Jefeh

unread,
Aug 25, 2010, 4:08:44 AM8/25/10
to Joomla! General Development
I found what is wrong!!.
Actually, it's the "i" uppercase in the template name... If I replace
it by a lowercase, it works.

Thanks nevertheless for your help

On 25 août, 08:41, Azamat Tokhtaev <krik...@gmail.com> wrote:
> try to rename the file default_grid_I21.php to default_default_grid_I21.php
>
> 2010/8/25 Jefeh <jfred.han...@gmail.com>
> > joomla-dev-gene...@googlegroups.com<joomla-dev-general%2Bunsubs cr...@googlegroups.com>
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/joomla-dev-general?hl=en-GB.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Joomla! General Development" group.
> > To post to this group, send an email to
> > joomla-de...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > joomla-dev-gene...@googlegroups.com<joomla-dev-general%2Bunsubs cr...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages