Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

I use K2, how do I assign a template to a category and items ?

I use K2, how do I assign a template to a category and items ?

hi
I use K2, how do I assign a template to a category and items
for example..

index.php?option=com_k2&view=itemlist&task=category&id=40:servicios-en-linea&Itemid=12
and others internal items

Thanks

geosdigital
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

Hi geosdigital,

You can try turning on MetaMod Advanced Debug mode - that can help you with a rule to identify the page you are on.

But from the URL above, I'd try this:

if ($content == "com_k2" and $view == "itemlist" ) return XXX; // on itemlist page

If you can give me some more URLS (e.g. for an individual item page, and a category list page, and any other type of page you want to target), and also the output from Advanced Debug mode, then I can be more specific.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

Oops, I just realised you are talking about MetaTemplate, not MetaMod. So MetaTemplate doesn't have an "Advanced Debug mode" - sorry!

Perhaps you could install MetaMod just so you can use the adv debug mode... install it, create a new MetaMod module and apply it to ALL pages, and switch on advanced debugging. Then you'll be given a PHP recipe on every page in that module. That should help to answer your question. The PHP given can be used almost identically in MetaTemplate. Post on here if you have any troubles with it.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

hi, thanks

for example
in
http://85.geosdigital.org/index.php?opt … p;Itemid=2

I have a template X (not the default) but when I go to the items
q I would like to maintain internal template, do not make it worse, and the breadcrumb does not assume
the template, so I use metatemplate that I did not understand

for example in

http://85.geosdigital.org/index.php?opt … ;Itemid=12

Thanks for your help

Edwin Bernal

geosdigital
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

Hi Edwin,

Sorry I don't quite understand yet...

At the moment your entire site uses the clinica2 template.

Which of the URLs from above is the one that you want to use an alternative template for?

http://85.geosdigital.org/index.php?opt … p;Itemid=2
or
http://85.geosdigital.org/index.php?opt … ;Itemid=12
??

If you want to use the default site template on the first URL, and an alternative template on the second URL, then I would use this:

if ( $option == "com_k2" and $view == "item" ) return true;

Then select your alternative template for this view in the SUCCEED ACTION part of MetaTemplate.

Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

Hi I have used the follownig code in Meta Template but something is not clear..
if ( $option == "com_k2" and $view == "item" ) return true;

If I put
if ( $option == "com_k2") return true;  it works fine in the pages that pages that have K2 items.

Now I would like to limit this to the K2 items that belong to a specific category.. 

can you give a clue on that? thanks..

kyriacoullis
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

I can think another option...
If my current URL contains "xxx" load this template....

Edit:  Actually I ve tried this and it is working just fine smile

kyriacoullis
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

Ok, glad that's working for you. Generally, the SEF URLs don't actually include the category name, so are you selecting it based on which menu item it's assigned to?

If you do want to get the exact category that a K2 item is in, you can do it this way:

if ($option == "com_k2" and $view == "item") {
  $k2id = (int)$id;
  $query = "select catid from #__k2_items where id = $k2id";
  $db->setQuery( $query );
  $catid = $db->loadResult();
  if ( $catid == XXX ) return YYY;
}
// replace XXX with the category id you are targetting,
// and YYY with the module to return for that category.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: I use K2, how do I assign a template to a category and items ?

Oops, just realised I answered your question as if it was MetaMOD you were asking about rather than MetaTEMPLATE.

It'll still work with a small adjustment:

if ($option == "com_k2" and $view == "item") {
  $k2id = (int)$id;
  $query = "select catid from #__k2_items where id = $k2id";
  $db->setQuery( $query );
  $catid = $db->loadResult();
  if ( $catid == XXX or $catid == YYY or $catid == ZZZ ) return true;
}
// you can add as many checks for $catid values on that last line as you like.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10137
Newest User:
lexispoker1
Members Online:
1
Guests Online:
285

Online: 
liaskas

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked