11 years ago
Topic

Hi all,

I know how to link a field to content in Seblod (select content in #2).

I use custom template with my lists (tpl_basic_list). I call my fields like that for exemple : renderField('art_title'); ?>

Is it possible to link this field to the content directly in my custom template ?

Thanks.

Get a VIP membership
11 years ago
0
Level 1

Hello,

$item->getLink('art_title');  will give you the link to article if you link this field to content. (select content in #2).


11 years ago
0
Level 1

Hi Nithin,

You mean, I need replace <?php echo $item->renderField('art_title'); ?> by <?php echo $item->getLink('art_title'); ?>  ?


85 Posts
Jpeg
11 years ago
0
Level 1

Hi,

logicaly, renderField apply plugin link (2) and plugin html (3) on value. No need to call getLink.

I do as I say on my custom template.

BR,
Jpeg


11 years ago
1
Level 1

Hello,

May be i misunderstood your question, I thought you require the link to content in template code.

As said by Jpeg renderField should includes link (2) automatically.

85 Posts
Jpeg
11 years ago
0
Level 2

Thx Nithin, maybe I misunderstund too...

@Xelory : You are obliged to bind plugin link (2) in the search form of your custom template list, without, it's "impossible" to create a link between field and content.

BR,
Jpeg


11 years ago
0
Level 1

Hi Jpeg,

I try with renderField and link (2) to view content on my title for exemple. It work but I have this notices :

Trying to get property of non-object in E:\wamp\www\mysite\components\com_cck\router.php on line 87, 91, 82, 85.

I don't know how to resolve this problem, that's why I try to link my article to content directly in my template. But it don't know what is the exact syntax, i'm not very familiar with php.



85 Posts
Jpeg
11 years ago
0
Level 1

Just a Notice don't panic :)

Otherwise The link are ok ?

you can disabled Notice in you joomla configuration "Server" - "report error" => "none" (maybe not the good therme).

Jpeg


11 years ago
0
Level 1

Yes, the link is ok. Notice is not error ? I thought I need to resolve all notices :)

85 Posts
Jpeg
11 years ago
0
Level 1

Nop Notice just notice lol

If you want, have you well configured the plug in ? have you attached a menu to show the content ? 

If you have already do this, plz post your notices in the seblod tracker :)

Have a nice WEnd,
Jpeg

11 years ago
0
Level 1

I think I know why I have this notice, but I have not the skill to resolve it.

I explain. My articles are displayed with custom List Template (tpl_basic_list). 5 articles are displayed. No problem to display content when I click on title for exemple.

Below my 5 articles liste, I create a link "show all articles".  To show all articles, I have create a new list and search without articles number display limitation. I create hidden menu with this new list. So my link "show all articles" refer to this list.

I have the notice explained in my new list, when i click on "show all articles" and when I click on title to view content.

Sorry for my english, I hope you understand what I say :)

I think this notice appears because of this link "show all articles".

Maybe you have an idea ? Maybe there is another solution to create a link "show all articles" ?




11 years ago
0
Level 1

I create hidden menu with this new list. So my link "show all articles" refer to this list. 


I think this needs to be checked, the error occurs with the object $menuitem which call for the active menu item in router.php

Pls post the tracker.

On the other side, if you access the list through the menu, whether notices have been removed?

11 years ago
0
Level 1

When I access the list throuh the menu, notice have been removed, no problem. I'm going to post the tracker. Thanks!

11 years ago
0
Level 1

Hi xelory,

Sorry, I come to the end of the discussion, can you give us the html code of the two links which you speak : the html code of the link "show all articles" and the html code of the menu link.

Regards,
Mehdi.

11 years ago
0
Level 1

Hi Mehdi,

I have posted rapport in tracker

My article's menu code with "show all articles" link : 

<?php
/**
* blank template by Jason Gallagher: www.jasongallagher.org
* @copyright     Copyright (C) 2012 Jason Gallagher. All Rights Reserved.
**/

// No Direct Access
defined( '_JEXEC' ) or die;

?>

<?php
require_once dirname(__FILE__).'/config.php';
$cck   =   CCK_Rendering::getInstance( $this->template );
if ( $cck->initialize() === false ) { return; }

$doc =& JFactory::getDocument();
$doc->addStyleSheet(juri::base()."templates/tpl_basic_list/css/basic_list.css");
?>

<?php
$items = $cck->getItems();
foreach( $items as $item ) {
$count=0;
$count++;
?>

<!-- IMPORTANT call your fields like $item->get('the_field')->value INSTEAD OF $cck->get('the_field')->value  -->

   <div id="ligneintro"></div>

     <div id="blockintro">

       <div id="intropic">
         <?php echo $item->renderField('image_introduction_decouvertes');?>
       </div>
  
       <div id="description">
         <h1 class="titredecouvertes"><?php echo $item->renderField('art_title'); ?></h1>
         <p class="creation">Crée le <?php echo $item->renderField('art_created');?> dans
         <?php echo $item->renderField('categorie_de_votre_chaine');?><?php echo $item->renderField('tags');?></p>
         <div class="texteintrodec"><?php echo $item->renderField('texte_introduction_decouvertes');?></div>
         
       </div>

     </div>
  
<?php } ?>

  <div id="liste">
   <a href="http://localhost/minsite/index.php?option=com_cck&view=list&search=decouvertes_liste_complete&task=search">Voir tous les articles</a> </div>

<?php $cck->finalize(); ?><?php

When users click on "show all articles" link, they are redirected on a new list and serach with the same code without the line with link "show all articles"

11 years ago
0
Level 1

Hi all,

Problem solved !

If you need to create links like "show all articles", you must use a list and search created in menu. You need to use the link of this list but dont take directly the link displayed in menu (link url), for exemple :

index.php?option=com_cck&view=list&search=maliste&task=search.

You will have notice error.


You need to use JCE Editor to get the url of your menu list, in this exemple, the good link is :

index.php?option=com_cck&amp;view=list&amp;search=maliste&amp;task=search&amp;Itemid=113


Now no notice error !

Best regards !

11 years ago
0
Level 1

Hello,

So you are missing itemid in link, that causing issue.

Get a Book for SEBLOD