facebook connect logout not working

just few days ago i needed to integrate “facebook Connect” to a website. With the documentation provided by facebook it was quite easy to integrate it. But i faced one issue that i was not able to find out solution.

The problem: There is a method provide in Facebook php library : “get_loggedin_user()”  Now this function returns the profile id of the user if the user is logged in using facebook before landing to the website or after coming to the website(through facebook connect). But if i logged out of facebook, this function still returned me the profile id of that user one or more time after refreshing the page. due to which i was not able to log out of the website.

Solution: I searched the web for the solution and found few, but none of them worked for me. I tried to delete facebook cookies through facebook library functions and manually too but in vain. Finally i thought of a solution myself and it worked for me. The solution is when i logged out of the website i logged out of facebook and set a special session variable to 1. Now i will check if that variable is one i will not log in the website despite of getting profile id through “get_loggedin_user()”. and once page is loaded i will set that special session variable to 0.

This solved the issue for me for now.

modalbox javascript onclose event

Today after along period writing a post. I tried a new javascript library called modalbox js. Was working very good, but i had to run other javascript when the box was closed. Found some help at http://code.google.com/p/modalbox/wiki/MethodsReference but didn’t found the exact syntax.

After some trial and error finally succeeded, so thought to post on to the blog. Here is the syntax for javascript as well as for symfony (in case you are working with symfony)

Syntax for symfony:

<?php echo m_link_to(‘link_name’,
‘url’,
array(‘title’ => ‘title’),
array(‘width’ => 630, ‘height’ => 180, ‘afterHide’ => ‘afterhidealert‘)); ?>

here afterhidealert is the javascript function that will be called on the closing of the modalbox popup.

Syntax for javascript:

<a href=”url” onclick=”Modalbox.show(this.href, {afterHide:afterhidealert, height:180, title:this.title, width:630}); return false;” title=”title”>link_name</a>

here afterhidealert is the javascript function that will be called on the closing of the modalbox popup.

Thanks,

samsami2u

http://www.avidindiainc.com

Error levels and their values in php

Value Constant Description
2 E_WARNING Non-fatal run-time errors. Execution of the script is not
halted
8 E_NOTICE Run-time notices. The script found something that might be
an error, but could also happen when running a script normally
256 E_USER_ERROR Fatal user-generated error. This is like an E_ERROR set by
the programmer using the PHP function trigger_error()
512 E_USER_WARNING Non-fatal user-generated warning. This is like an E_WARNING
set by the programmer using the PHP function trigger_error()
1024 E_USER_NOTICE User-generated notice. This is like an E_NOTICE set by the
programmer using the PHP function trigger_error()
4096 E_RECOVERABLE_ERROR Catchable fatal error. This is like an E_ERROR but can be
caught by a user defined handle (see also set_error_handler())
8191 E_ALL All errors and warnings, except level E_STRICT (E_STRICT
will be part of E_ALL as of PHP 6.0)

Couldn’t get short alias for (

The below query didn’t worked for me and gave me the error “Couldn’t get short alias for ( re” and so i did removed the spaces from between every ‘or’ and brackets ‘(‘. i have added the modified query below the original query.

$restaurant = Doctrine_Query::create()
->select(‘re.*’)
->from(‘ReservationHoursSetting re’)
//->where(“re.id <> ? AND re.reservation_setting_id = ? AND ( (re.hr_from > {$hourFrom} AND re.hr_from < {$hourTo}) OR (re.hr_to > {$hourFrom} AND re.hr_to < {$hourTo}) )”, array($HourID, $restaurantSettingID) )
//->where(“re.id <> ? AND re.reservation_setting_id = ? AND ( ( re.hr_from BETWEEN {$hourFrom} AND {$hourTo} ) OR ( re.hr_to BETWEEN {$hourFrom} AND {$hourTo} ) OR ( {$hourFrom} BETWEEN re.hr_from AND re.hr_to )  OR ( {$hourTo} BETWEEN re.hr_from AND re.hr_to ) )”, array($HourID,$restaurantSettingID) )
->where(“re.id <> ? AND re.reservation_setting_id = ? “, array($HourID,$restaurantSettingID) )
->andWhere(“((re.hr_from > {$hourFrom}  AND re.hr_from< {$hourTo})

OR (re.hr_to > {$hourFrom} AND re.hr_to < {$hourTo})

OR (re.hr_to > {$hourFrom}  AND re.hr_from < {$hourFrom})

OR (re.hr_to < {$hourTo}  AND re.hr_from > {$hourTo})

OR (re.hr_to = {$hourTo}  AND re.hr_from = {$hourFrom}))”)
->fetchArray();

====================

$restaurant = Doctrine_Query::create()
->select(‘re.*’)
->from(‘ReservationHoursSetting re’)
//->where(“re.id <> ? AND re.reservation_setting_id = ? AND ( (re.hr_from > {$hourFrom} AND re.hr_from < {$hourTo}) OR (re.hr_to > {$hourFrom} AND re.hr_to < {$hourTo}) )”, array($HourID, $restaurantSettingID) )
//->where(“re.id <> ? AND re.reservation_setting_id = ? AND ( ( re.hr_from BETWEEN {$hourFrom} AND {$hourTo} ) OR ( re.hr_to BETWEEN {$hourFrom} AND {$hourTo} ) OR ( {$hourFrom} BETWEEN re.hr_from AND re.hr_to )  OR ( {$hourTo} BETWEEN re.hr_from AND re.hr_to ) )”, array($HourID,$restaurantSettingID) )
->where(“re.id <> ? AND re.reservation_setting_id = ? “, array($HourID,$restaurantSettingID) )
->andWhere(“((re.hr_from > {$hourFrom}  AND re.hr_from< {$hourTo}) OR (re.hr_to > {$hourFrom} AND re.hr_to < {$hourTo}) OR (re.hr_to > {$hourFrom}  AND re.hr_from < {$hourFrom}) OR (re.hr_to < {$hourTo}  AND re.hr_from > {$hourTo}) OR (re.hr_to = {$hourTo}  AND re.hr_from = {$hourFrom}))”)
->fetchArray();

add categories with images on homepage – magento

to add categories along with images on homepage

just add the code given below to your homepage from admininstration cms management.

{{block type="catalog/navigation" name="catalog.category" template="catalog/category/list.phtml"}}
Also you need to create a list.phtml file under “/app/design/frontend/default/default/template/catalog/category/list.phtml”
and add the below given code to it:
===========================================
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php $open
= $this->isCategoryActive($_category); ?>
<?php
$cur_category
=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
if (
$immagine = $this->getCurrentCategory()->getImageUrl()):
?>

<div style="float: left; padding-right: 30px; text-align: center;">
<
div class="linkimage">
<
p>
<
a href="<?php echo $this->getCategoryUrl($_category)?>">
<
img src="<?php echo $immagine ?>" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="135" height="135" />
<?php echo $_category->getName()?>
</a>
</
p>
</
div>
</
div>

<?php endif; ?>
<?php
endforeach; ?>

================================================