Joomla clean current page (com_content) cache - joomla

How can I delete current's page com_content cache ?
Something what I tried, but not working.
$cache =& JFactory::getCache();
$cache->clean(413, "com_content");

<?php
$cache =& JFactory::getCache();
$cache->cleanCache(413, "com_content");
?>

Related

codeigniter - Flashdata not clearing

i'm new with codeigniter and use flashdata to display message from controller to view. However, flashdata is not cleared automatically after i refresh the view or move to the other pages and back it still remain. Please help.
Here is my code in controller:
$this->session->set_flashdata('_flash_message', 'Thanks for your subscription.');
redirect(site_url('cp/subscribe'), 'refresh');
In view:
<?php echo $this->session->flashdata('_flash_message'); ?>
I used XAMPP for localhost, already turn off cache mode.
Try
On Controller
$this->session->set_flashdata('flash_message', 'Thanks for your subscription.');
redirect(base_url('cp/subscribe'));
On View
<?php if ($this->session->flashdata('flash_message') {
<?php echo $this->session->flashdata('flash_message');?>
<?php }?>
In the view you need to add an if statement to check if the flashdata is set. When refreshing the browser it will not be set so the message will not reappear.
<?php if($this->session->flashdata('_flash_message')) : ?>
<?php echo '<p>' .$this->session->flashdata('_flash_message'). '</p>'; ?>
<?php endif; ?>

Add custom category attribute to the frontend.

Pages of different category should display different footers and is the idea behind.
I know there are lot of similar questions and I tried them all, but they didn't work.
I have added custom category attribute to category page, and I want to see it in the footer.
I tried to use:
<?php if($_customAttribute = $this->getCurrentCategory()->getCustomAttribute()): ?>
<?php echo $_helper->categoryAttribute($_category, $_customAttribute, 'footer_text') ?>
But I have not got any results for this.
You can try it like this.
$category = Mage::registry('current_category');
<?php if ($category->getFooterText()) : ?>
<?php echo Mage::helper('catalog/output')->categoryAttribute($category, $category->getFooterText(), 'footer_text');?>
<?php endif;?>
But keep in mind...if you add this in footer.phtml it won't work with the block cache on. The footer is cached, so once you load a page the code above will have no effect on the next pages.
[EDIT]
If you want to have a different footer on some pages you need to modify the cache key for the footer block. There is an explanation on how to do that in here but it's for a simple page not a category. The concept is the same.
What you need to do is to change only the getCacheKeyInfo method to depend on the category. Something like this:
public function getCacheKeyInfo()
{
$info = parent::getCacheKeyInfo();
$category = Mage::registry('current_category');
if ($category) {
$info[] = $category->getId();
}
return $info;
}

How to call a joomla module in virtuemart shop.browse page

How can a joomla module be called inside the virtuemart shop.browse page. I tried the following code inside the browse_layouttable.tpl.php but it is not working for me. I am using joomla1.5.23 and the virtuemart version is 1.1.8. Any suggestion?
<?php
$modules =& JModuleHelper::getModules('logo');
foreach ($modules as $module)
{
echo JModuleHelper::renderModule($module)
}
?>
Try this
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$Module = &JModuleHelper::getModule('mod_fmDataGrid');
$Params = "param1=bruno\n\rparam2=chris"; //if you want to pass params
$Module->params = $Params;
echo $renderer->render($Module);
I would suggest you use "Modules Anywhere" from NoNumber:
http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/embed-a-include/6402
After you install this plugin you can add module positions directly in your browse page PHP using this example:
{modulepos mynewposition}
This is a must have plugin for all Joomla users, because you can use it throughout your site.

integrating my own joomla login to main site

I am trying to make my own login form to extend more field information. I try to build it separate from my my site, so I save it to testlogin.php in base Joomla main site directory. Here is my script:
<?php
define('_JEXEC', 1 );
define ('JPATH_BASE', dirname(_FILE_));
define('DS',DIRECTORY_SEPARATOR);
require_once(JPATH_BASE.DS.'includes'.DS.'defines.php');
require_once(JPATH_BASE.DS.'includes'.DS.'framework.php');
require_once(JPATH_BASE.DS.'libraries'.DS.'joomla'.DS.'factory.php');
$mainframe =& JFactory::getApplication('site');
$mainframe ->initialise();
$credentials=Array('username' => 'dadanuser', 'password' => 'dadan');
$options=Array('remember' => true);
$mainframe->login($credentials, $options);
//echo $result;
$user =& JFactory::getUser();
echo $user->username;
$session =& JFactory::getSession();
$myUser = $session->set( 'myUser', $user );
?>
I run it directly and I get login with username: dadanuser, but when I open Joomla main site I still not login yet, maybe I have to set session in right way?
anyone can help ?
Why reinvent the wheel? If you are in 2.5 or 3 you can just use a profile plugin to add the extra fields. If you are in 1.5 you can use the earlier version of that which was distributed as an extension.
http://joomlacode.org/gf/project/usermeta

$data['main_content'] to load view in subfolder in CodeIgniter

Here is my function:
function single_resonator() {
$data['title'] = 'Single Resonator Operating Parameters';
$data['main_content'] = 'products/single_res_view';
$this->load->view('templates/main.php', $data);
}
But the single_res_view doesn't load if it is in the products folder in the views folder. How do I accomplish this? I tried a file called MY_router.php from a post elsewhere on this site and it didn't help. CI will only load the single_res_view if it is in the root of the views folder.
Here is templates/main.php
<?php $this->load->view('includes/header.php'); ?>
<?php $this->load->view('includes/nav.php'); ?>
<?php $this->load->view($main_content); ?>
<?php $this->load->view('includes/footer.php'); ?>
Have you tried this:
$data['main_content'] = 'products/single_res_view.php';
If not, can you triple check that the path and file names are correct? Otherwise, can you echo the value of $main_content just in case you're overwriting it somewhere?

Resources