joomla3.0

How to use cookies from a component?

試著忘記壹切 提交于 2019-12-04 11:19:37
问题 How can I use cookies in a Joomla component? setcookie( JUtility::getHash('JLOGIN_REMEMBER'), false, time() - 86400, '/' ); Can anybody describe how this works? 回答1: // Get input cookie object $inputCookie = JFactory::getApplication()->input->cookie; // Get cookie data $value = $inputCookie->get($name = 'myCookie', $defaultValue = null); // Check that cookie exists $cookieExists = ($value !== null); // Set cookie data $inputCookie->set($name = 'myCookie', $value = '123', $expire = 0); //

Add Custom Button to Joomla's Article Editor (TinyMCE)

天涯浪子 提交于 2019-12-03 16:58:23
问题 I'm trying to insert an additional button in Joomla's article editor. It's using the default TinyMCE plug in Extended mode. As you'll already know there are 4 buttons underneath the editor (Article, Image, Page Break and Read More). What I'd like to do is insert a 5th button. (I did attach a image button SO said I can't post as need a minimum of 10 rep points.) I have tried copying the Page Break Button plugin and renaming it etc, then re-installing it as a new plugin, but all that does it

Joomla getUser() does not show the updated user data

ぐ巨炮叔叔 提交于 2019-12-03 16:24:59
Below code allows me to show the user's name in the profile page of the Joomla profile of a user. Given that I have overridden the template to get the look and feel I want. $user =& JFactory::getUser(); if (!$user->guest) { echo 'You are logged in as:<br />'; echo 'Real name: ' . $user->name . ''; } My problem is I allow user to update his or her profile. After he updates the his name, database is updated correctly but it does not show the updated name in the profile page. When I go through Joomla docs I found out that user data is stored in the session(JFactory::getUser()). If I print_r($

Joomla hacked. How to prevent? [closed]

烂漫一生 提交于 2019-12-03 15:27:43
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Ok, so one of my websites ( on joomla) is being hacked like the 6th time... I won't tell you any stories. Only facts: Firstly, I found that in template index file appeared some alien code: <div id='hideMe'> <p>Every person knows the large quan...|...ur cure Viagra <a href="xxxxx">Viagra</a> </div><script type='text/javascript'>if(document.getElementById('hideMe') != null){document.getElementById(

How to use Joomla Ajax Interface for my own plugin

人走茶凉 提交于 2019-12-03 08:47:25
I'm developing a custom plugin for Joomla 3. I'm trying to make an ajax call to my plugin. I've looked into the Joomla Ajax Interface and followed what was described. But when I make the call, the json response is empty, even if I'm echoing a value. Here is my PHP code: class plgContentMyPlugin extends JPlugin { public static function onAjaxSendMail() { //Get the app $app = JFactory::getApplication(); $data = "test"; //echo the data echo json_encode($data); //close the $app $app->close(); } } Here is my Ajax request: jQuery.ajax( { type: "POST", url: "index.php?option=com_ajax&plugin=myplugin

Joomla Database - How to use LIMIT in getQuery?

Deadly 提交于 2019-12-03 08:35:37
问题 I want to build the below query using joomla inbuilt database class. SELECT * FROM table_name ORDER BY id DESC LIMIT 1 This is the query I have built up to now. $db =& JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->nameQuote('*')); $query->from($db->nameQuote(TABLE_PREFIX.'table_name')); $db->setQuery($query); $rows = $db->loadObjectList(); I don't know how to add the limit(LIMIT 1) to the query. Can someone please tell me how to do it? Thanks 回答1: Older than Joomla 3.0

How to use cookies from a component?

十年热恋 提交于 2019-12-03 07:05:23
How can I use cookies in a Joomla component? setcookie( JUtility::getHash('JLOGIN_REMEMBER'), false, time() - 86400, '/' ); Can anybody describe how this works? // Get input cookie object $inputCookie = JFactory::getApplication()->input->cookie; // Get cookie data $value = $inputCookie->get($name = 'myCookie', $defaultValue = null); // Check that cookie exists $cookieExists = ($value !== null); // Set cookie data $inputCookie->set($name = 'myCookie', $value = '123', $expire = 0); // Remove cookie $inputCookie->set('myCookie', null, time() - 1); Some rules about $expire value its a Unix

Add Custom Button to Joomla's Article Editor (TinyMCE)

痴心易碎 提交于 2019-12-03 05:56:52
I'm trying to insert an additional button in Joomla's article editor. It's using the default TinyMCE plug in Extended mode. As you'll already know there are 4 buttons underneath the editor (Article, Image, Page Break and Read More). What I'd like to do is insert a 5th button. (I did attach a image button SO said I can't post as need a minimum of 10 rep points.) I have tried copying the Page Break Button plugin and renaming it etc, then re-installing it as a new plugin, but all that does it cause errors with TinyMCE and no button appears. Question : How do I insert the button? I've continued my

Joomla Database - How to use LIMIT in getQuery?

两盒软妹~` 提交于 2019-12-02 22:27:43
I want to build the below query using joomla inbuilt database class. SELECT * FROM table_name ORDER BY id DESC LIMIT 1 This is the query I have built up to now. $db =& JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->nameQuote('*')); $query->from($db->nameQuote(TABLE_PREFIX.'table_name')); $db->setQuery($query); $rows = $db->loadObjectList(); I don't know how to add the limit(LIMIT 1) to the query. Can someone please tell me how to do it? Thanks Older than Joomla 3.0 $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('*') ->from($db->nameQuote('#__table

Article Tags shown in Article List-Layout

天大地大妈咪最大 提交于 2019-12-02 18:41:10
问题 So I've been adding tags you add to articles in Joomla!, which works fine. But now I want to show the tags in the article list layout that is default in Joomla. I found and made an override for the list-layout and tried to add the tags code from a single article layout to the list-layout. Underneath is the code I tried to add in the list-layout. But none of the tags are shown in the layout.. <?php // set tags $tags = ''; if (!empty($this->item->tags->itemTags)) { JLoader::register(