Jump to content

Need help with joomla $this variable


carlosx2

Recommended Posts

Ok so i am really stuck here. I am trying to determen how the variable $this is being set and where. I am modifying the com_content of joomla. Only the carticle and i would like to connect the article with K2 component. But to do this i need to load information from the joomla data base.

 

so far i have gotten this far. I am adding this below the article text. I am getting the name of the article and set into a variable. I have no idea where $this is being loaded with the jos_article stuff but it does that. I need to find that page to understand how it is working. So i have gotten this far.

 

<?php echo $this->article->text;
      $tests = $this->article->title;
      print_r ($tests);
       ?>

 

Now i want to connect to the k2 table within the joomla database to search is the name of the article is also represented in the k2 table. If so it will out put a link to the k2 table if there is non it will out put nothing.

 

My question is how do i connect to the k2 table when the $this variable is loaded with all the info from article content. I need to know how i can load a second variable that loads all the K2 table content. I have noticed that also in the K2 component $this is being set to get all the info.

 

How hard is it to find this variable in the script pages. lol

 

I hope i made it clear what i am looking for.

 

thanks

Link to comment
Share on other sites

I've not used Joomla, but I'm sure it uses an MVC architecture. $this likely refers to the View object.

   

Generally what happens is templates are pulled into the View object before they are rendered, thus making $this refer to the object itself (the View).

   

Now, what that View object is called and what file it's in I don't know, but that is where I would start.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.