How to clear cache automatically?

Hello,

In Dolphin 7.1.3, how to clear the cache automatically when the profile page is loaded?

I Wanna clear the cache in Admin panel, under tools option, which has store cache is displayed in pie chart without manually.

Can any one give idea asp.

Thanks in Advance.

Quote · 31 Jul 2013

So you want to clear all the caches when a profile page is loaded.  If you have a problem with the profile page on load that you think is connected to the cache, list that problem so we may help with a real solution.

Geeks, making the world a better place
Quote · 31 Jul 2013

ya. You are right.. I have the problem when the profile page is loaded.

I have added a new block in profile page. That the block will works based on condition.

If the condition is satisfied that block will be visible. otherwise it will not visible.

Here only I have the problem when the condition works.

Quote · 31 Jul 2013

 

ya. You are right.. I have the problem when the profile page is loaded.

I have added a new block in profile page. That the block will works based on condition.

If the condition is satisfied that block will be visible. otherwise it will not visible.

Here only I have the problem when the condition works.


Page blocks have individual caching. Edit the block and make sure the caching is disabled. Set to 0 for that custom block.


https://www.deanbassett.com
Quote · 31 Jul 2013

I have set 0 for that block. but the same problem occurs again. when I clear the Admin panel DB cache thats will work properly.

Quote · 1 Aug 2013

 

Here only I have the problem when the condition works.

 Exactly what is the problem you are experiencing? 

Geeks, making the world a better place
Quote · 1 Aug 2013

I added new block in profile page and added the new column 'Pid' in 'Profiles' Table in database. and add the below code in profile.php

$iPid = $GLOBALS['MySQL']->getOne("SELECT `Pid` FROM `Profiles` WHERE `ID` = ".$memberID." LIMIT 1");

if($iPid == 0)

{

$sSql = "UPDATE `sys_page_compose` SET `Column`='1' WHERE `Caption` = 'Certifications'";

 $bResult = (int)$GLOBALS['MySQL']->query($sSql);

}

else {

$sSql = "UPDATE `sys_page_compose` SET `Column`='0' WHERE `Caption` = 'Certifications'";

 $bResult = (int)$GLOBALS['MySQL']->query($sSql);

}

 

Here when the $iPid is '0' the column is SET 1 for that Certification block. Otherwise the column is SET 0.that's why I have to clear the cache in each time when the profile page is loaded.

Quote · 2 Aug 2013

Ah, now i see.

Your not using a proper method to hide and show a block. That's why your having problems.

Your Certifications block should be a php block. The code to check for this should be in that php block.
 

Reason.. The way php blocks work is they will not be displayed on the page if there is no output. So if you check within the block itself, you can use that check to determine if the content of the block is to be displayed or not.

If you do it this way, it will function properly without the need to clear the cache and there will be far less overhead on the systems resources.


https://www.deanbassett.com
Quote · 2 Aug 2013

Thanks for the reply deano.

Now I have changed the certification block to php block. But still I have facing the same problem.

Quote · 2 Aug 2013

Your code in profile.php has to be removed.

As i stated, your php block must handle the checks and only display data when the proper condition is met.

You have to do this properly for it to work.

https://www.deanbassett.com
Quote · 2 Aug 2013

There is any way to set the block visible for different users like member,guest?

Any solution to split the member - Teacher and Student?

Here I have set 'Pid' is 0 for Teacher and 1 for student.

I wanna to set the Certification block is visible for only who logged as a Teacher.

Quote · 2 Aug 2013

I will give you some example code. Put this in a php block.


if(getLoggedId() > 0) {
    echo 'Member logged in.';
}


That code will show a block containing the text Member logged in.

The block will only show up for logged in members, but will not be there when a guest views the page. And it will do it properly without having to clear the cache.

https://www.deanbassett.com
Quote · 2 Aug 2013

Yes. You need to do this.

$iPid = $GLOBALS['MySQL']->getOne("SELECT `Pid` FROM `Profiles` WHERE `ID` = ".$memberID." LIMIT 1");
if($iPid == 0) {
   In this section you put the information you want displayed.
}

What happens is the block will output data only when $iPid == 0. Other wise it does nothing. If the block does not output anything, dolphin will simply not display it.


https://www.deanbassett.com
Quote · 2 Aug 2013

I have removed that the code in profile.php.

As i stated, your php block must handle the checks and only display data when the proper condition is met.

Do you mean that the condition should be in that block content?

Kindly describe what I do fix this problem..

Quote · 2 Aug 2013

Actually you will need to check for a logged in member as well. Becuse iPid will always be 0 for a guest based on that code.

So something more like this.

if($memberID > 0) {
   $iPid = $GLOBALS['MySQL']->getOne("SELECT `Pid` FROM `Profiles` WHERE `ID` = ".$memberID." LIMIT 1");
   if($iPid == 0) {
      In this section you put the information you want displayed.
   }
}

https://www.deanbassett.com
Quote · 2 Aug 2013

 

I have removed that the code in profile.php.

As i stated, your php block must handle the checks and only display data when the proper condition is met.

Do you mean that the condition should be in that block content?

Kindly describe what I do fix this problem..

I also ready described what has to be done.

Show me the content of your block. I will write the code for you. I guess your not understanding all the samples i am providing.


https://www.deanbassett.com
Quote · 2 Aug 2013

if(getLoggedId() > 0) {    echo 'Member logged in.';
}

Here also the same problem happens. When I logged as a Member the block is displayed. But if I logged as a guest it is displayed again.

When I clear the cache in Admin panel it will not visible. It doesn't work properly without clear the cache??

Quote · 2 Aug 2013

ya. This is my code which is written in the Certification block content.

$memberID = getLoggedId();

$iPid = $GLOBALS['MySQL']->getOne("SELECT `Pid` FROM `Profiles` WHERE `ID` = ".$memberID." LIMIT 1");

if($iPid == 0)

{

$sSql = "UPDATE `sys_page_compose` SET `Column`='1' WHERE `Caption` = 'Certifications'";

 $bResult = (int)$GLOBALS['MySQL']->query($sSql);

}

else {

$sSql = "UPDATE `sys_page_compose` SET `Column`='0' WHERE `Caption` = 'Certifications'";

 $bResult = (int)$GLOBALS['MySQL']->query($sSql);

}

 

echo "<div id='#' style='margin: 10px 10px 0; overflow: hidden;'><button class='bx-btn bx-btn-img' onclick=showPopupAnyHtml('http://localhost/Social-english/m/files/upload');> Upload </button></div>";

Quote · 2 Aug 2013

Then you have a problem.

That simply is not suppose to happen. You have a caching system problem somewhere.

But i also do not understand how you can clear the cache in admin while testing as a guest.

In any case. You have something wrong with dolphins caching system or a external caching engine.



https://www.deanbassett.com
Quote · 2 Aug 2013

I put up a test on my site. http://www.deanbassett.com/

And as i suspected, this code.

if(getLoggedId() > 0) {
    echo 'Member logged in.';
}

Works exactly as it is suppose to.

You can join my site and see for yourself that it works.


https://www.deanbassett.com
Quote · 2 Aug 2013

But i also do not understand how you can clear the cache in admin while testing as a guest.login as a guest in one browser. And login as a Admin in another browser. When I face the cache problem in the guest profile page. I will clear the cache in the Admin panel which is opened in another browser. Then refresh the guest profile page.

That's may be wrong with dolphins caching system or a external caching engine as you told, how can I resolve this?

Quote · 2 Aug 2013

Deano,

your way is working fine. Thanks a lot. Cool

Quote · 2 Aug 2013
Can I add the below content in the php block in sys_page_compose Table when I install the module?
I've tried many ways.But it shows more errors.
Anybody help me.
 
$memberID = getLoggedId();
$iPid = $GLOBALS['MySQL']->getOne("SELECT `Pid` FROM `Profiles` WHERE `ID` = ".$memberID." LIMIT 1");
if($iPid==1) 
{
echo "<div id='#' style='margin: 10px 10px 0; overflow: hidden;'><button class='bx-btn bx-btn-img' onclick=window.open('inviteteacher.php','_self')> Study with Private Teacher </button></div>";
}
Quote · 8 Aug 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.