my code only shows one image from the database. I dont know whats the problem. I tried looping it with allthe divs and ul but nothing it only shows one image. my code is
<div class="fullwidthbanner-container">
<div class="fullwidthbanner">
<?php
$about = slider();
while($about_fetch=mysql_fetch_array($about)){
?>
<ul>
<li data-transition="fade" data-slotamount="7">
<img src="images/<?php echo $about_fetch["slide"];?>" alt="">
<?php
}?>
</li>
</ul>
<!--<div class="tp-bannertimer"></div>-->
</div><!-- end .banner -->
</div><!-- end .bannercontainer -->
for the code-part, try this please:
(i assume, you dont want to have several <ul> elements and only the <li>'s)
<div class="fullwidthbanner-container">
<div class="fullwidthbanner">
<ul>
<?php
$about = slider();
while($about_fetch=mysql_fetch_array($about)){ ?>
<li data-transition="fade" data-slotamount="7">
<img src="images/<?php echo $about_fetch["slide"];?>" alt="">
</li>
<?php } ?>
</ul>
</div><!-- end .fullwidthbanner -->
</div><!-- end .fullwidthbanner-container -->
Well, your HTML isn't valid. You're looping over the start of a <ul> and <li> and not closing either until after the loop.
If that isn't the problem, then we can't help you since there is no debugging information available. Break your problem up into pieces. Is the issue server-side or client-side? Look at your output HTML to be sure. What are the return values of mysql_fetch_array() for each iteration? var_dump() is your friend.
Related
code below is long but really straight forward only require code to put forward ability to slide from first slide to last slide to that return to first slide to traverse.
<div class="orbit" role="region" aria-label="Favorite Space Pictures" data-orbit>
<div class="orbit-wrapper">
<div class="orbit-controls">
<button class="orbit-previous"><span class="show-for-sr">Previous Slide</span>◀︎</button>
<button class="orbit-next"><span class="show-for-sr">Next Slide</span>▶︎</button>
</div>
<ul class="orbit-container">
<?php
foreach($employers as $employer){
echo '<li class="orbit-slide">
<figure class="orbit-figure">
'.$this->Html->image($employer['image'], ['alt'=>'employer image',
"class"=>"orbit-image"]).'
<figcaption class="orbit-caption">'.
$employer['brief'].
$employer['name'].
$employer['desg'].
$employer['created'].'
</figcaption>
</figure>
</li>
';
}
?>
</ul>
</div>
<nav class="orbit-bullets">
<?php
$i=0;
foreach($employers as $employer){
echo '<button data-slide="'.$i.'">
<span class="show-for-sr">First slide details.</span>
<span class="show-for-sr" data-slide-active-label>Current Slide</span>
</button>';
$i++;
}
?>
</nav>
</div>
code below is to slide thumbnail images traverse from first to last and return to first as above but with thumbnails that show product slide 4-5 at one go. Below code must show 4-5 thumbnails with small text and traverse as timer and button click play a role.
<div class="ecommerce-product-slider orbit" role="region" aria-label="Favorite Space Pictures" data-orbit>
<ul class="orbit-container">
<button class="orbit-previous"><span class="show-for-sr">Previous Slide</span>◀︎</button>
<button class="orbit-next"><span class="show-for-sr">Next Slide</span>▶︎</button>
<?php
foreach($sectorsandcourses as $sectorandcourse){
echo '<li class="orbit-slide">
<div class="row small-up-2 medium-up-4 large-up-5 align-center">
<div class="column">
<div class="product-card">
<div class="product-card-thumbnail">
<a href="#" class="th">'.
$this->Html->image($sectorandcourse['image'], ['alt'=>'Image for sector and courses',
'style'=>'width:100%;']).'</a>
</div>
<h2 class="product-card-title">'.$sectorandcourse['sectors_and_courses'].'</h2>
<span class="product-card-desc">Product Description</span>
<span class="product-card-price">'.$sectorandcourse['count'].'</span>
</div>
</div>
</div>
</li>';
}
?>
</ul>
<nav class="orbit-bullets">
<?php
foreach($sectorsandcourses as $sectorandcourse){
echo '
<button class=data-slide="0">
<span class="show-for-sr">First slide details.</span><span class="show-for-sr">Current Slide</span>
</button>';
}
?>
</nav>
</div>
so both are different do not get confused be kind to put forward a relation between both but not to confuse them as same since one is a full screen slide show next one is thumbnail slideshow.
vision to make :
fullscreen slideshow
thumbnail slide show
Is your question the following?
i only require to work with that code that works to enable slide show beyond seond slide and return to first slide
If so please shorten your complete question to this (loop, start with first slide after last).
This already works by default as data-infinite-wrap is true by default.
https://get.foundation/sites/docs/orbit.html
https://get.foundation/sites/docs/orbit.html#js-options
You did not specify the exact Foundation version (6.x.y, x and y are needed) and we would need a https://codepen.io to see your actual problem.
Also try to remove is-active from your output. This may be the cause. And only provide generated html code so that we can reproduce your issue.
Orbit has been discontinued i suggest use carousel with bootstrap.
This question already has answers here:
Hiding a Div using php
(6 answers)
Closed 1 year ago.
I have a foreach look that checks if user has a picture or not. If the user doesn't have the picture I want to hide a <li> tab that shows the picture.
Inside my else how do I say, for this user hide tab 2?
I tried using echo 'id="tabHeader_2" style:"visibility:hidden"; but that doesn't work. I need a reference to that tab2, don't I?
<div id="picture<?php echo $i ?>" style="display: none;">
<?php
$picture = $user->pic;
if(isset($picture))
{
// show picture.
}
else
{
// hide tab2
}
?>
</div>
Then the list of tabs:
<div class="profiles">
<div id="tabContainer">
<div class="tabs">
<ul>
<li id="tabHeader_1"> Profile </li>
<li id="tabHeader_2"> Picture </li>
</ul>
</div>
<div id="tabsContent">
<div class="tabpage" id="tabpage_1"></div>
<div class="tabpage" id="tabpage_2"></div>
</div>
<script src="<?php echo Yii::app()->theme->baseUrl; ?>/js/tabs.js"></script>
</div>
</div>
Picture of what the page looks like:
I am not 100% sure about your code, but you are using isset() which would not be correct, because you set the variable right behind that check so it will be set 100% of the time. You will want to check empty() or is_file() perhaps, depends on what is in that variable.
<!-- This display: none seems strange if you are going to show the wrapped elements -->
<div id="picture<?php echo $i ?>" style="display: none;">
<?php
$picture = $user->pic;
if(!empty($picture)) {
// show picture.
}
else {
// hide tab2
}
?>
</div>
If you put the real code, it would be easier to see how you are laying out your elements.
Do Like This :-
<div class="tabs">
<ul>
<?php
$i = 1;
foreach($yourarray as $key => $value){
if(isset($value) && $value != '')
?>
<li id="tabProfileHeader<?php echo $i;?>"> Profile </li>
<li id="tabPictureHeader<?php echo $i;?>"> Picture </li>
<?php
$i++;
}
?>
</ul>
</div>
I have a php page that has many includes. The whole page runs fine, but for my navigation bar, it does not open any page when I click on it. Please, what is missing here. Any help will be appreciated. many thanks
Here are my codes for the includes
<div id='cssmenu'>
<ul>
<li class='active'><span>Home</span></li>
<li><span>About Us</span></li>
<li><span>Packages</span></li>
<li><span>Partners</span></li>
<li><span>Gallery</span></li>
<li class='last'><span>Contact Us</span></li>
</ul>
</div>
And here is my main page code:
<body>
<div id="wrapper">
<div>
<img src="images/banner.png" width="940" height="200" />
</div>
<?php include('includes/nav.php'); ?>
<?php include('includes/slider.php'); ?>
<?php include('includes/nav.php'); ?>
<?php include('includes/contents.php'); ?>
<?php include('includes/sidebar.php'); ?>
<?php include('includes/footer.php'); ?>
</div> <!-- End #wrapper -->
</body>
Not sure of your file structure, but try removing the '../' on all you links
Change this:
<li class='active'><span>Home</span></li>
to this:
<li class='active'><span>Home</span></li>
Take the ../ out of your path.
When you include the nav.htm to your main page it acts as if it is in the main folder
Therefore if you use '../' it won't find it.
I am using yahoo weather feed and simplepie to get weather for my digital display. Since it is a website run on a screen, I can't refresh the browser all the time manually.
I am just wondering is there anything eg jquery or php doc can help me update the weather information periodically as the weather changes?? If so would you be able to give me some directions on how to implement? your help is greatly appreciated.
Here is some of my code just in case it is useful
<div id="weather">
<div id="title">
<ul>
<!--<li> Outside Temp </li>-->
<li> Today </li>
<li> Tomorrow </li>
</ul>
</div> <!--title-->
<div id="forecast">
<div id="images">
<ul>
<?php foreach ($weather->get_forecasts() as $forecast): ?>
<li><img src="<?php echo $forecast->get_image(); ?>" alt="Weather" /></li>
<?php endforeach; ?>
</ul>
</div> <!--images-->
<div id="degrees">
<ul>
<?php foreach ($weather->get_forecasts() as $forecast): ?>
<li><?php echo $forecast->get_low(); ?>° <?php echo $forecast->get_high(); ?>° </li>
<?php endforeach; ?>
</ul>
</div><!--degrees-->
</div> <!--forecast-->
<!--</div> <!--second-->
Some header part info:
<php
require_once('simplepie/simplepie.inc');
require_once('simplepie/simplepie_yahoo_weather.inc');
$feed = new SimplePie();
$feed->set_feed_url('http://weather.yahooapis.com/forecastrss?w=1234567&u=c');
$feed->set_item_class('SimplePie_Item_YWeather');
$feed->init();
$weather = $feed->get_item(0);
?>
Thank you very much!
S:)
Since you're not already using JavaScript, a really simple way for you to periodically refresh the page might be to use the meta refresh tag. Although deprecated, it might be a quick way for you to get dynamic pages. Simply add the tag to the <head> of the page:
<meta http-equiv="refresh" content="5"> <!--Refresh the page every 5 seconds-->
However, you might want to consider using ajax to load your content into the page instead. This might not be the best possible approach to this but here's some quick and dirty code.
In the main page, you could use jQuery load to periodically hit the URL for your PHP script and load the content into a div for display:
<html>
<head>
<script type="text/javascript">
$(document).ready(function(){
setTimeout(loadWeather, 5000); //using setTimeout instead of a setInterval to avoid having multiple queries queue up when the first one fails to return within the timeout period
});
function loadWeather(){
$('#weather').load('weather.php);
setTimeout(loadWeather, 5000);
}
</script>
</head>
<body>
<div id="weather" />
</body>
</html>
where weather.php might look something like this:
<div id="weather">
<div id="title">
<ul>
<!--<li> Outside Temp </li>-->
<li> Today </li>
<li> Tomorrow </li>
</ul>
</div> <!--title-->
<div id="forecast">
<div id="images">
<ul>
<?php foreach ($weather->get_forecasts() as $forecast): ?>
<li><img src="<?php echo $forecast->get_image(); ?>" alt="Weather" /></li>
<?php endforeach; ?>
</ul>
</div> <!--images-->
<div id="degrees">
<ul>
<?php foreach ($weather->get_forecasts() as $forecast): ?>
<li><?php echo $forecast->get_low(); ?>° <?php echo $forecast->get_high(); ?>° </li>
<?php endforeach; ?>
</ul>
</div><!--degrees-->
</div> <!--forecast-->
<!--</div> <!--second-->
Im created a custom block, with the below code, but im having some trouble turning the Group Title into an link, that will take the user back to the group at anytime.
Below is the code ive used, I thought active turns it into a link, but perhaps im being stupid.
<div class="active"><h2><?php print $group_title; ?></h2></div>
Below is the full code:
<?php $group_title = og_get_group_context()->title; ?>
<?php $group_nid = og_get_group_context()->nid; ?>
<?php $forum_link = og_forum_get_forum_container($group_nid); ?>
<div class="active"><h2><?php print $group_title; ?></h2></div>
<div class="content"
<div class="item-list">
<ul>
<li class="user-input-link"><a title="Add a new Forum topic"href="/node/add/forum?gids[]=<?php print $group_nid; ?>">Add a new forum topic</a>
</ul>
</div>
</div>
You need to create URL for it to work.
Here is the link to API with more info: http://api.drupal.org/api/drupal/includes--common.inc/function/l/6
<div class="active"><h2><?php print l($group_title, "node/{$group_nid}"); ?></h2></div>
You need to do an anchor tag, like:
<div><h2><?php print $group_title; ?></h2></div>
I don't know how to get the url in Drupal though..