First of all, my question may be unclear. I will try to explain it.
this is my html
<div class="left"><?php print $search_box; ?><?php if (!empty($logo)): ?><img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" id="logo" width="243" height="62" /><?php endif; ?><?php if (!empty($site_name)): ?><div id='site-name'><strong><?php print $site_name; ?></strong></div><?php endif; ?><?php if (!empty($site_slogan)): ?><div id='site-slogan'><?php print $site_slogan; ?></div><?php endif; ?></div>
looks ugly and difficult to debug, right?
so i try to indent and add newline. However, it will fails on some browser, may be IE6. The result is changed. So, What should i go, should i use another doctype?
Currently, i am using
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
You can write it this way too:
<div class="left">
<?php print $search_box; ?>
<?php if (!empty($logo)) { ?>
<a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>" rel="home">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" id="logo" width="243" height="62" />
</a>
<?php } ?>
<?php if (!empty($site_name)) { ?>
<div id='site-name'>
<strong>
<?php print $site_name; ?>
</strong>
</div>
<?php } ?>
<?php if (!empty($site_slogan)) { ?>
<div id='site-slogan'><?php print $site_slogan; ?></div>
<?php } ?>
</div>
This should work in most cases, or you can use the php heredoc syntax to echo out the html stuff normally.
Related
html code
In this html code, I would like to select the element with <p>utilisé 2X</p>
How can I do ?
Thanks a lot
I have tried on the php code to add a class but I don't find it
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class="boxannonces">
<h2><?php the_title(); ?></h2>
<p><br /><?php the_excerpt(); ?></p>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><?php the_category(); ?></p>
<p><?php the_tags(); ?></p>
<p class="date"><small><?php the_date(); ?></small></p>
</div>
<hr />
<?php
}
?>
You don't say how you want to select the HTML code. With CSS so you can style it? You also don't say which <p> contains "utilisé 2X".
Just give whichever <p> it is a class and refer to it that way.
<p class="twice">utilisé 2X</p>
.twice {
/* CSS stuff */
}
I have a site with a sticky footer, which is not so sticky and I am having a hard time figuring it out.
This is the html part: html.tpl.php
<?php
?>
<!DOCTYPE html>
<head>
<?php $head; ?>
<title><?php print $head_title='Vit | Kringvarp Føroya'; ?></title>
<?php if ($default_mobile_metatags): ?>
<?php endif; ?>
<meta http-equiv="cleartype" content="on">
<?php print $styles; ?>
<?php print $scripts; ?>
<?php if ($add_html5_shim and !$add_respond_js): ?>
<?php elseif ($add_html5_shim and $add_respond_js): ?>
<?php elseif ($add_respond_js): ?>
<?php endif; ?>
</head>
<body class="<?php print $classes; ?>" <?php print $attributes;?>>
<div class="container">
<?php if ($skip_link_text && $skip_link_anchor): ?>
<p id="skip-link">
<a href="#<?php print $skip_link_anchor; ?>" class="element-invisible
element-focusable"><?php print $skip_link_text; ?></a>
</p>
<?php endif; ?>
<?php print $page; ?>
</div>
<?php print $page_footer; ?>
</body>
<?php print $page_bottom; ?>
</div>
</html>
And page.tpl.php part
<div id="navigation">
<?php print render($page['navigation']); ?>
</div>
<header class="header" id="header" role="banner">
<?php $front_page='http://kvf.fo/vit';
if ($logo): ?>
<a href="<?php print $front_page; ?>" title="<?php print
t('Heim'); ?>"
rel="home" class="header__logo" id="logo"><img src="<?php print
$logo; ?
>" alt="<?php print t('Heim'); ?>" class="header__logo-image" />
</a>
<?php endif; ?>
<?php if ($site_name || $site_slogan): ?>
<div class="header__name-and-slogan" id="name-and-slogan">
<?php if ($site_name): ?>
<h1 class="header__site-name" id="site-name">
<a href="<?php print $front_page; ?>" title="<?php print t('Heim');
?>" class="header__site-link" rel="home"><span><?php print
$site_name; ?></span></a>
</h1>
<?php endif; ?>
<?php if ($site_slogan): ?>
<div class="header__site-slogan" id="site-slogan"><?php print
$site_slogan; ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php print render($page['header']); ?>
</header>
<div id="main">
<?php print render($page['content']); ?>
</div>
<?php print render($page['footer']); ?>
<?php print render($page['bottom']); ?>
The css part.
html {
position: relative;
min-height: 100%;
}
body {
height: 100%;
}
.container {
margin: 0 0 125px;
}
#footer {
position: absolute;
left: 0;
bottom: 0;
height: 100px;
width: 100%;
}
The page adress is www.kvf.fo/vit , and it seems to be working ok, but on an Ipad, the footer "sinks" halfway under the bottom of the screen, which is a bummer because the main users to the site, are Ipad users :/
Any help is much obliged!
If you want your footer to be sticky so add this property in its css
footer {
position: fixed;
}
It seems you're closing the body tag to early:
</div>
<?php print $page_footer; ?>
</body>
<?php print $page_bottom; ?>
</div>
I'm trying to hide a div when the custom field is empty. When I don't use an image in the "palette" custom field I want it to hide <div class="small-12 large-12 columns center">. Thanks in advance.
<div class="small-12 large-12 columns center">
<?php
$image = get_field('palette');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
</div>
The classes on the div have padding and margins assigned to them which is creating the spacing. Removing the div all together when will remove the classes solving the issue.
You could move the if statement around the whole div, like this:
<?php
$image = get_field('palette');
if( !empty($image) ):
?>
<div class="small-12 large-12 columns center">
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
</div>
<?php endif; ?>
if you want to hide the div you should do this :
<div class="small-12 large-12 columns center"
<?php
$image = get_field('palette');
if (empty($image)){?>style="display:none"<?php } ?>
>
<?php
$image = get_field('palette');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
</div>
With the code below now working can anyone suggest how I pull out the image from the collection at a larger size, this is only working for thumbnails at the moment.
<?php
if(!hook("EditorsPick")):
/* ------------ Collections promoted to the home page ------------------- */
$home_collectionsx=get_home_page_promoted_collectionsx(16);
foreach ($home_collectionsx as $home_collectionx)
{
?>
<div class="EditorsPick">
<div class="HomePanel"><div class="HomePanelINtopEditors">
<div class="HomePanelINtopHeader">Editors Pick</div>
<div class="HomePanelINtopText">This is the editors pick of Asset Space...</div>
<div class="EditorsPicImage"><div style="padding-top:<?php echo floor((155-$home_collectionx["thumb_height"])/2) ?>px; margin-top: -24px; margin-bottom: -15px;">
<a href="<?php echo $baseurl_short?>pages/search.php?search=!collection<?php echo $home_collectionx["ref"] ?>" onClick="return CentralSpaceLoad(this,true);"><img class="ImageBorder" src="<?php echo get_resource_path($home_collectionx["home_page_image"],false,"thm",false) ?>" width="<?php echo $home_collectionx["thumb_width"] ?>" height="<?php echo $home_collectionx["thumb_height"] ?>" /></div>
</div></div>
</div>
</div>
</div>
<?php
}
endif; # end hook homefeaturedcol
?>
function get_home_page_promoted_collectionsx($id=null)
{
$filterClause = '';
if(!is_null($id))
{
$filterClause = ' AND collection.ref = '.intval($id);
}
return sql_query("select collection.ref,collection.home_page_publish,collection.home_page_text,collection.home_page_image,resource.thumb_height,resource.thumb_width from collection left outer join resource on collection.home_page_image=resource.ref where collection.public=1 and collection.home_page_publish=1".$filterClause." order by collection.ref desc");
}
<img class="ImageBorder" src="<?php echo get_resource_path($home_collectionx["home_page_image"],false,"thm",false) ?>" width="<?php echo $home_collectionx["thumb_width"] ?>" height="<?php echo $home_collectionx["thumb_height"] ?>" />
Why not edit this to set your desired size in pixels, like
<img class="ImageBorder" src="<?php echo get_resource_path($home_collectionx["home_page_image"],false,"thm",false) ?>" width="1000" height="800" />
I'm having following codes in osclass\oc-content\themes\modern\item.php,
<strong class="share"><?php _e('Map', 'modern'); ?></strong>
<strong class="share"><?php _e('Photo Gallery', 'modern'); ?></strong>
<div class="map" style="display:none;">
<?php osc_run_hook('location'); ?>
</div>
<div class="slider-wrapper theme-light image" >
<div id="slider" class="nivoSlider">
<?php if( osc_images_enabled_at_items() ) { ?>
<?php if( osc_count_item_resources() > 0 ) { ?>
<?php for ( $i = 0; osc_has_item_resources(); $i++ ) { if (osc_resource_for() == 2 ) { ?>
<img src="<?php echo osc_resource_url(); ?>" width="100%" height="240px;" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
<?php } } ?>
<?php } ?>
<?php } osc_reset_resources(); ?>
</div>
</div>
and JavaScript code is,
$("#photo").click(function() {
$(".image").css("display","block");
$(".map").css("display","none");
});
$("#map").click(function() {
$(".map").css("display","block");
$(".image").css("display","none");
});
here photo is loading as good. But map makes following problem when I click #map.
If I load map at 1st and set display:none; to .image means, map will be loaded as fully and good.
Where is the problem?
I just tested version 3.1 and it's working on my localhost