85 Posts
yuberlin
8 years ago
4
Topic

Is it possible to use two different template overrides für the same content type? At the moment i use templates overrrides with seb_minima and i want to change frontend forms without dublicating content-type because i want to use the new forms with the existing content later on. 

So changing template override in menu manager would be a cool feature, right?

Get a VIP membership
1283 Posts
Bucklash
8 years ago
0
Level 1

Hi

I had a question like this before (different forms for same content type).

The only option is conditional 'if () {} else {}' statements within the override

Bucklash

85 Posts
yuberlin
8 years ago
0
Level 1

Can you explain this? One thing i could do is split the code in my_contenttype/site/mainbody.php to something like

if( $_GET["newtmpl"] ) {
   include 'my_new_template.php';
}
else {
   include 'my_old_template.php';
}

Then i could load my new override with .../my_old_siteform.html&newtmpl=1

Should try this out...

85 Posts
yuberlin
8 years ago
1
Level 1

Nope...the solution above doesnt work...

1283 Posts
Bucklash
8 years ago
0
Level 2

Hi

I would suggest, in your form, grabbing the value to test ie 

create a text field, called something like 'override_selector':
'live' column: select 'user'
'live value' column: select configure, then user = current, property = guest
(if guest the value returned is 1)
then in your override add something like:
<?php if ($cck->getValue('override_selector') == 1) { ?>
<div id="guest-display">
    ...guest-related divs and fields...
</div>
<?php } else { ?>
<div id="registered-display">
   ...registered-related divs and fields...
</div>
<?php } endif; ?>
<br>

If your form was in a module, then I think you can override this value in the Seblod Form overrides area.

Have module set to all pages and select the override value ie '1' for guest and access level is guest and one for registered users

Here is a an answer from James Morrell from a post I submitted a while back:

<?php if ($cck->getValue('art_access') == 10) : ?>
<div id="superman-display">
    ...superman-related divs and fields...
</div>
<?php elseif ($cck->getValue('art_access') == 11) : ?>
<div id="batman-display">
   ...batman-related divs and fields...
</div>
<?php endif; ?>
<br>

Here is some code by  Klas from another forum post describing how you might load a file based on url id

$itemId = JFactory::getApplication()->input->getInt('Itemid');if ($itemId == 999)
{
include_once 'somefile.php';
}
else
{
include_once 'someotherfile.php';
}
<br>

Hope it helps in some way

I'm no expert but try and answer when I can as I know the pain of banging your head against a wall!!

Get a VIP membership