How make fancybox working with symfony framework? - frameworks

I am using symfony 1.4. I would like to ask you for a help with fancy box. How can i make that fancy gallery after click on my image. Please.
Well i tried do something like that:
in apps/fronted/config/viey.yml
javascripts: [jquery-1.4.3.min.js, jquery.fancybox-1.3.4.js]
also put that files in css folder web/js
in apps/fronted/config/templates/layout.php i leave it with no changes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//PL" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<?php include_http_metas() ?>
<?php include_metas() ?>
<?php include_title() ?>
<?php include_stylesheets() ?>
<?php include_javascripts() ?>
</head>
<body>
<div id="container">
<div class="content">
<?php echo $sf_content ?>
</div>
</div>
</body>
in apps/fronted/modules/myshop/templates/homeSuccess.php i wrote
<a id="single_image" href="images/braceles/1.jpg">
<img src="images/braceles/1.jpg" alt=""/></a>
after that i click on image, it redirect me to page with image instead that fancy view :( i don't get it, what is that "single_image" and what do i do wrong?
Please help me, thanks user! :)

I use fansybox like :
In apps/fronted/config/view.yml
javascripts: [jquery-1.6.2.min.js,fancybox/jquery.fancybox-1.3.4.js,fancybox/jquery.easing-1.3.pack.js,fancybox/jquery.mousewheel-3.0.4.pack.js,fancybox/fancyconfig.js]
stylesheets: [fancybox/jquery.fancybox-1.3.4.css]
In my fancyconfig.js
$(document).ready(function(){
$("a#image_fancybox").fancybox({
'titlePosition' : 'over',
'overlayOpacity' : 0.4
});
});
In my apps/fronted/modules/mymod/templates/indexSuccess.php
<a id="image_fancybox" title="<?php echo $project->getDescription()?>" href="<?php echo "/uploads/projects/".$project->getImage() ?>"> <img src="<?php echo "/uploads/projects/thumbnails/thumb_".$project->getImage() ?>" alt="<?php echo $project->getDescription() ?>"/></a>
So, it is work. You can use firebug in firefox , that debug you js code.

Related

Open Graph not showing in WordPress

It would appear that the WordPress theme that I am working with was not optimized to work with open graph tags. I changed this line of code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
to this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" <?php language_attributes(); ?>>
When I run the url through the debugging tool on FB, it sees the proper image for the homepage, but that's about the only progress I get. When attempting to share an article it pulls no description or image at all (I use featured images) and the FB Debugger says "document returned no data" when I check to see what the scraper returned for the site.
I have had issues with OG tags before and have, through trial and error, solved the problem. This is really frustrating me. I've even tried adding three plugins at once that would all populate the tags, and then running the debugger, hoping it would give me the error message saying "multiple og tags." It does not. Did I not add the code in my header the correct way?
I will provide my entire header code just in case anyone needs it.
<?php include( TEMPLATEPATH . '/includes/options.php' ); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/screen.css" type="text/css" />
<!--[if lte IE 7]><link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/ie.css" type="text/css" media="screen, projection" /><![endif]-->
<!--[if lte IE 6]><link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/ie6.css" type="text/css" media="screen, projection" />
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/nav.js"></script><![endif]-->
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php if ( $mb_subscribe_feed ) { echo $mb_subscribe_feed; } else { bloginfo('rss2_url'); } ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if (is_singular()) wp_enqueue_script('comment-reply'); ?>
<?php wp_head(); ?>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.qtip.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.qtip.style.js"></script>
</head>
<body<?php if ($mb_clean == 1) { echo ' class="clean"'; } ?>>
<!-- header -->
<div id="header"<?php if ($mb_clean == 1) { echo ' class="clean"'; } ?>>
<div id="header-inner">
<div id="header-bottom">
<?php if ($mb_logo == 1) { ?>
<div id="logo-custom" style="width:<?php echo $mb_logo_width; ?>px; height:<?php echo $mb_logo_height; ?>px;"><?php bloginfo('name'); ?><span style="background: url('<?php echo $mb_logo_image; ?>') no-repeat 0 0"> </span></div>
<?php } else { ?>
<div id="logo"<?php if ($mb_clean == 1) { echo ' class="clean"'; } ?>><?php bloginfo('name'); ?><span> </span></div>
<?php } ?>
<?php if ( !$mb_leaderboard ) echo''; else { ?>
<div id="ad-leaderboard">
<?php echo $mb_leaderboard; ?>
</div>
<?php } ?>
<!-- nav -->
<div id="nav">
<div id="navlist">
<?php mb_nav(); ?>
</div>
</div>
<!-- /nav -->
<!-- social -->
<div id="social"<?php if ($mb_clean == 1) { echo ' class="clean"'; } ?>>
<ul>
<?php if ($mb_subscribe_email) { ?><li id="social-email">Email Updates</li><?php } ?>
<?php if ($mb_subscribe_feed) { ?><li id="social-feed">RSS Feed</li><?php } else { ?><li id="social-feed">RSS Feed</li><?php } ?>
<?php if ($mb_social_twitter) { ?><li id="social-twitter">Twitter</li><?php } ?>
<?php if ($mb_social_myspace) { ?><li id="social-myspace">MySpace</li><?php } ?>
<?php if ($mb_social_facebook) { ?><li id="social-facebook">Facebook</li><?php } ?>
</ul>
</div>
<!-- /social -->
</div>
</div>
</div>
<!-- /header -->
First off, the DOCTYPE and opening HTML tags should be separate -- not combined like you have them. See here:
https://www.w3schools.com/tags/tag_doctype.asp
Finally, use a plugin like Complete Open Graph to set up the appropriate prefix and Open Graph tags. It's automatic and should solve your problem, unless you want to continue to fight it manually.
https://wordpress.org/plugins/complete-open-graph/

how to check session in zend layout

layout.phtml:
<?php echo $this->doctype() ?>
<html>
<head>
<?php echo $this->headTitle()."\n"; ?>
<?php echo $this->headLink() ."\n"; ?>
<?php echo $this->headScript(); ?>
</head>
<body>
<div id="wrap">
<div class="header">
<div class="logo"><img src="../../images/logo.gif" alt="" title="" border="0" /></div>
<div id="menu">
<ul>
<li class="selected">home</li>
<li>about us</li>
<li>books</li>
<li>specials books</li>
<li>my accout</li>
<li>register</li>
<li>prices</li>
<li>contact</li>
<li>adddbook </li>
</ul>
</div>
</div>
<div class="center_content">
<div class="left_content">
<?php echo $this->layout()->content ?>
I am new to zend framework here i am facing problem with displaying navigations. in pure php i can serve my navigation by checking sessions. like this:
<?php
if($_SESSION['usertype']=='admin')
{
echo "<li>adddbook </li>";
}
?>
My question is how can i implement this in zend framework. Thanks
You can do this in a myriad of ways like the Zend_Auth, but the closes to the $_SESSION method is using Zend_Session.
First you need to start Zend_Session before any output is sent to the browser, just like a normal php session. I do it in my index.php right after setting all my paths and autoloaders.
Zend_Session::start();
Next step is creating a namespace for the userinformation and adding the relevant information to it, preferably when you authenticate the user.
$userInfo = new Zend_Session_Namespace('userInfo');
$userInfo->userType = 'admin';
This is the equivalent to setting a $_SESSION['userInfo']['userType'] = 'admin';
Last, get the information in your layout:
<?php
$userInfo = new Zend_Session_Namespace('userInfo');
if($userInfo->userType=='admin')
{
echo "<li>addbook </li>";
}
?>
Read this link for more information http://framework.zend.com/manual/en/zend.session.html
If you want to check an user role, you could use the class Zend_Auth provided by the framework. You can check the credential of a user and then affect it a role.
To retrieve this role you can check the identity of the user with the Zend_Auth instance :
$identity = Zend_Auth::getInstance()->getIdentity();
if (strcmp($identity->role, "admin") == 0) {
echo '<li>adddbook </li>';
}

Zend Layout Double Div

Hi i want to put two div in a zend view. After i want to have the two div in different position. My problem is that i want to have the normal content adn i want to add another div that rapresent the side menu
For example my view is:
<div id="view-menuscritte">
List menu
</div>
<div id="view-content">
<?php
echo $this->errorMessage;
echo $this->form;
?>
</div>
When I use in my layout
<div id="menu">
<img id="menusopra" src=<?php echo $this->baseUrl().'/img/menusopra.jpg'; ?> >
<div id="menuscrittegenerale">
<?php echo $this->layout()->menuscritte; ?>
</div>
<img id="menusotto" src=<?php echo $this->baseUrl().'/img/menusotto.jpg'; ?>
</div>
<div id="contentgenerale">
<?php echo $this->layout()->content; ?>
</div>
The problem is that the two div (->content and ->menuscritte) are in the same div.
view-menuscritte is not in menuscrittegenerale where it could be.
Inside folder of layout.phtml , create menu.phtml
cut and paste following content from your view into menu.phtml
<div id="view-menuscritte">
List menu
</div>
Now in your layout.phtml replace
<?php echo $this->layout()->menuscritte; ?>
with
<?php echo $this->partial('menu.phtml);?>

z-index issue on iPad/iPhone

first of all I have very little experience with CSS/HTML, I'm not a webdesigner/coder, basically I have no clue what I'm doing.
I'm also close to kill myself because nothing helped. I really appreciate everyone who's trying to help me.
When you go on pawelpietryka.com and hover on the image it slides in a div via webkit transition and basically everything works.
I'm also using a webkit inset shadow which is animated too. I had big issues with this shadow because it always appeared behind the image (not in front) ... I hacked it with these changes
#demo-5 img { z-index: -1; position: relative; vertical-align: top; }
As soon as I put the z-index: -1; in it doesn't work on iPad/iPhone anymore, I'm tapping on the container and nothing happens.
(I'm assuming it doesn't have a hover state and when I'm trying to tap it it's somehow BEHIND the main layer.)
I've seen this on other page and the ideal scenario would be: 1) First tap box slides in 2) Second tap jump to destination.
Thanks!
If you think of your div nesting as a pyramid such as...
<pyramid>
<section level="1">
<section level="2">
</section>
</section>
</pyramid>
You can't get level 2 to appear under level 1, because level 1 contains level 2. If you would want level 2 to appear over level 2, usually they would be siblings, i.e
<pyramid>
<section level="1"></section>
<section level="2"></section>
</pyramid>
But in your specific case, I would recommend putting the image as the background of the div
<div id="boxes">
<?php while ( have_posts() ) : the_post(); ?>
<div class="box">
<a href="<?php the_permalink(); ?>">
<div class="rel" id="demo-5" style="background: transparent url(<?php the_post_thumbnail('homepage-thumb'); ?>) top left no-repeat">
<div class="detailsausgeblendet">
<h1><?php the_title(); ?></h1>
<?php the_excerpt() ?>
</div>
</div>
</a>
</div>
<?php endwhile; ?>
</div>
Trying to post it here, the formatting is odd on comments
<div id="boxes">
<?php while ( have_posts() ) : the_post(); ?>
<div class="box">
<a href="<?php the_permalink(); ?>"><div class="rel" id="demo-5" style="background-image:<?php the_post_thumbnail('homepage-thumb'); ?>">
<div class="detailsausgeblendet">
<h1><?php the_title(); ?></h1>
<?php the_excerpt() ?>
</div>
<?php endif ?>
</div></a>
</div>
<?php endwhile; ?>
</div>
And this is the code 'unchanged'
<div id="boxes">
<?php while ( have_posts() ) : the_post(); ?>
<div class="box">
<div class="rel" id="demo-5">
<?php the_post_thumbnail('homepage-thumb', array('alt' => '', 'title' => '')) ?>
<?php if ($imbalance2_theme_options['images_only'] == 0): ?>
<a href="<?php the_permalink(); ?>"><div class="detailsausgeblendet">
<h1><?php the_title(); ?></h1>
<?php the_excerpt() ?>
</div></a>
<?php endif ?>
</div>
</div>

Zend_Navigation menu works but not breadcrumbs

I have configured my zend navigation menu like
Config: http://pastebin.com/B212uWKz
public function _initNavigation() {
$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
$navigation = new Zend_Navigation($config);
$this->bootstrap('view');
$view = $this->getResource('view');
$view->navigation($navigation);
}
Layout
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Zend Navigation Test</title>
</head>
<body>
<?php echo $this->navigation()->menu(); ?>
<hr />
<?php echo $this->navigation()->breadcrumbs(); ?>
<hr />
<?php echo $this->layout()->content; ?>
</body>
</html>
The menu works but not the breadbrumbs. I also tried from here
<?php echo $this->navigation()->breadcrumbs()
->setLinkLast(false)
->setMinDepth(0)
->render(); ?>
Still only the menu works
Maybe they use different containers?
Maybe max depth?
<?php echo $this->navigation()->breadcrumbs()
->setLinkLast(false)
->setMinDepth(0)
->setMaxDepth(500)
->render($this->navigation()->getContainer()); ?>
Looking at your code I think that the problem might be because you use uri tags rather then controller and action tags. For instance instead of:
<home>
<label>Home</label>
<uri>/</uri>
</home>
there should be:
<home>
<label>Home</label>
<controller>index</controller>
<action>index</action>
</home>
Hope it will work for you.