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

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();

setAuthenticated in symfony for frontend and backend

The problem:

i had two applications 1) frontend and 2) backend.

but when i login into backend i was automatically login into the frontend application.

The Solution:

the solution is simple you have to define the session name for both the application or atleast one. so that the sessions for both of them differ from each other.

you can define the session name in the “\apps\backend\config\factories.yml” file

here

cli:
controller:
class: sfConsoleController
request:
class: sfConsoleRequest
response:
class: sfConsoleResponse

test:
storage:
class: sfSessionTestStorage

all:
#  controller:
#    class: sfFrontWebController
#
#  request:
#    class: sfWebRequest
#
#  response:
#    class: sfWebResponse
#
#  user:
#    class: myUser
#
storage:
class: sfSessionStorage
param:
session_name: symfonyBack
#
#  view_cache:
#    class: sfFileCache
#    param:
#      automaticCleaningFactor: 0
#      cacheDir:                %SF_TEMPLATE_CACHE_DIR%

i have given a name for the backend application (symfonyBack).

database connection in symfony 1.0

There are two files that needs to be configure database connection in symfony 1.0:

Both the below files as found in <project>\config\         directory(folder)

1) database.yml:

all:
propel:
class:      sfPropelDatabase
param:
phptype:  mysql
hostspec: localhost
database: symfonycms
username: root
password:
#port: 80
encoding: utf8 # Default charset for table creation
#persistent: true # Use persistent connections

or as a short hand for the above

all:
propel:
class:      sfPropelDatabase
param:
phptype:  mysql
dsn: mysql://root:password@localhost/databas
#port: 80
encoding: utf8 # Default charset for table creation
#persistent: true # Use persistent connections

2)propel.ini

propel.targetPackage       = lib.model
propel.packageObjectModel  = true
propel.project             = symfonycms
propel.database            = mysql
propel.database.createUrl  = mysql://localhost/
propel.database.url        = mysql://root:@localhost/symfonycms

propel.addGenericAccessors = true
propel.addGenericMutators  = true
propel.addTimeStamp        = false

propel.schema.validate     = false

; directories
propel.home                    = .
propel.output.dir              = /var/www/production/sfweb/www/cache/symfony-for-release/1.0.20/sf_sandbox
propel.schema.dir              = ${propel.output.dir}/config
propel.conf.dir                = ${propel.output.dir}/config
propel.phpconf.dir             = ${propel.output.dir}/config
propel.sql.dir                 = ${propel.output.dir}/data/sql
propel.runtime.conf.file       = runtime-conf.xml
propel.php.dir                 = ${propel.output.dir}
propel.default.schema.basename = schema
propel.datadump.mapper.from    = *schema.xml
propel.datadump.mapper.to      = *data.xml

; builder settings
propel.builder.peer.class              = addon.propel.builder.SfPeerBuilder
propel.builder.object.class            = addon.propel.builder.SfObjectBuilder

propel.builder.objectstub.class        = addon.propel.builder.SfExtensionObjectBuilder
propel.builder.peerstub.class          = addon.propel.builder.SfExtensionPeerBuilder
propel.builder.objectmultiextend.class = addon.propel.builder.SfMultiExtendObjectBuilder
propel.builder.mapbuilder.class        = addon.propel.builder.SfMapBuilderBuilder
propel.builder.interface.class         = propel.engine.builder.om.php5.PHP5InterfaceBuilder
propel.builder.node.class              = propel.engine.builder.om.php5.PHP5NodeBuilder
propel.builder.nodepeer.class          = propel.engine.builder.om.php5.PHP5NodePeerBuilder
propel.builder.nodestub.class          = propel.engine.builder.om.php5.PHP5ExtensionNodeBuilder
propel.builder.nodepeerstub.class      = propel.engine.builder.om.php5.PHP5ExtensionNodePeerBuilder

propel.builder.addIncludes = false
propel.builder.addComments = false

propel.builder.addBehaviors = false

Fatal error: Unsupported operand types in lib\symfomy\util\spyc.class.php on line 667

If this is due to the change you had done in your project’s /config/schema.yml then the problem is the syntax in your schema.yml

possibly you have written

(incorrect)

cat_id:                    { type: INTEGER, required:true, primaryKey: true}

instead of

(correct)

cat_id:                    { type: INTEGER, required: true, primaryKey: true}

here the difference between the above two line of code is: the incorrect one is having no space between required: and true, while the correct one is having the space between the two.

so whatever attributes you write leave a space between the attribute name and attribute value.

I hope this will help you out.