I am using ordered list with php and its working fine and showing the numbers 1-10 correctly but in the next page its starting again from 1 for different list. I have tried some solutions found in this site, but not working. Given below is my code so far. Here $startpoint =10;
<ol start="<?php echo $startpoint;?>">
<li>
<?php echo $objA->stringtag($question); ?>
</li>
</ol>
Try to something like this. I think in your File not getting $startpoint value. So, it's start with 1.
<?php $startpoint = 10; ?>
<ol start="<?php echo $startpoint;?>">
<li><?php echo 'teastesest' ?> </li>
<li><?php echo 'teastesest' ?> </li>
<li><?php echo 'teastesest' ?> </li>
<li><?php echo 'teastesest' ?> </li>
</ol>
Related
I'm making a dynamic menu where each link in my dropdown menu will be directed to a page base on the ID in the HREF link. How can I POST the ID from my link?
Here's my code:
<?php
$lesson_sql = "SELECT * FROM lesson WHERE lessonID = 1";
$lesson_query = mysqli_query($db, $lesson_sql);
$lesson = mysqli_fetch_assoc($lesson_query);
?>
<nav id="navbar">
<ul id="navmenu">
<div class="navmenu">
<li><strong>Catalog</strong><span class="darrow"></span>
<ul class="sub1">
<li>Topic 1
<ul class="sub1_1">
<?php
do {
?>
<li>
<a href="lesson1.1.php?lessonID=<?php echo $lesson['lessonID'];?>">
<?php echo $lesson['lessonName']; ?>
</a>
</li>
<?php
}while ($lesson = mysqli_fetch_assoc($lesson_query));
?>
</ul>
</li>
</ul>
</li>
</div>
</ul>
</nav>
And here is the code from the code above I wanted to get the ID, its beside the href value.
<li><?php echo $lesson['lessonName']; ?></li>
Sorry for my english, I hope you understand me!
in your lesson1.1.php file you can use $_GET to access the id as below.
$id = $_GET["lessonID"];
If you have query string then you use
$_GET['name of control']
I'm trying to highlight the winner in a basketball game by comparing the scores of two team, and highlighting the winner (highest score) team, by adding a class "winner" to the HTML element like this:
<ul class="game-result">
<li class="winner"><span>Team 1</span><?php echo $team1_points; ?></li>
<li class=""><span>Team 2</span><?php echo $team2_points; ?></li>
</ul>
I'm using wordpress and php, any help would be appreciated!
Thanks
Like so
<ul class="game-result">
<li <?php echo (($team1_points>$team2_points)?'class="winner"':''); ?>><span>Team 1</span><?php echo $team1_points; ?></li>
<li <?php echo (($team2_points>$team1_points)?'class="winner"':''); ?>><span>Team 2</span><?php echo $team2_points; ?></li>
</ul>
<ul class="game-result">
<li <?=($team1_points > $team2_points ? "class='winner'" : "")?> ><span>Team 1</span><?php echo $team1_points; ?></li>
</ul>
<ul class="game-result">
<li <?php echo (($team1_points>$team2_points)?'class="winner"':'class=""'); ?>><span>Team 1</span><?php echo $team1_points; ?></li>
<li <?php echo (($team2_points>$team1_points)?'class="winner"':'class=""'); ?>><span>Team 2</span><?php echo $team2_points; ?></li>
</ul>
Even though Flyer's answer is correct, this one will make your code look exactly as you posted it in the question description.
Today I am studying OpenCart for my next project. And I am having a trouble with my code. What I want to do is to simply add another link in admin navigation menu under the Catalog list. But whenever I edit the header.tpl it doesn't show my update. Here's what I did.
I add another link named 'mypage'
The file is located at: admin/view/template/common/header.tpl
Here's my update
<div id="menu">
<ul class="left" style="display: none;">
<li id="dashboard"><?php echo $text_dashboard; ?></li>
<li id="catalog"><a class="top"><?php echo $text_catalog; ?></a>
<ul>
<li><?php echo $text_category; ?></li>
<li><?php echo $text_product; ?></li>
<li><?php echo $text_filter; ?></li>
<li><?php echo $text_profile; ?></li>
<li><a class="parent"><?php echo $text_attribute; ?></a>
<ul>
<li><?php echo $text_attribute; ?></li>
<li><?php echo $text_attribute_group; ?></li>
</ul>
</li>
<li><?php echo $text_option; ?></li>
<li><?php echo $text_manufacturer; ?></li>
<li><?php echo $text_download; ?></li>
<li><?php echo $text_review; ?></li>
<li><?php echo $text_information; ?></li>
<li><?php echo $text_mypage; ?></li>
</ul>
</li>
As you can see I added another link below information.
Now the next step I include the language variable in the controller
The file is located at: admin/controller/header.php
I added this line:
$this->data['text_mypage'] = $this->language->get('text_mypage');
Now the last step I did is I include the link in my language file
The file is located at: admin/language/english/common/header.php
I added this line:
$_['text_mypage'] = 'My Page';
Now my problem is it doesn't show my link. I don't know where did I get wrong. Please help me I am new in this framework. I also cleared the cache manually but same effect.
Jerielle,
I think you are missing a point here in this file.
in admin/controller/header.php
you also need to define
$this->data['mypage'] = $this->url->link('your_link', 'token=' .
$this->session->data['token'], 'SSL');
like this.
Check this page carefully you will find this section on this file..
I've been making a website for a client that is based off of 1 page and the links are to different categories or articles. I'm showing the content depending on the URL parameter like this,
<a href="index.php?cat_id=<?php echo $category['cat_id']" >
usually to do a navigation highlight depending on the page I would do something like this,
PHP
<ul>
<li <?php if($pagename == "index.php"){ echo 'class="selected"'; } ?>>
Home
</li>
<li <?php if($pagename == "about.php"){ echo 'class="selected"'; } ?>>
About
</li>
<li <?php if($pagename == "services.php"){ echo 'class="selected"'; } ?>>
Services
</li>
<ul>
but my URLS are dynamic from the database like so,
PHP
<ul>
<li>Home</li>
<?php while ($category = $statement->fetch()) { ?>
<li><?php echo $category['cat_name']; ?></li>
<?php
}
?>
</ul>
So I was wondering how can I add the class selected to the links cat_id when the URL contains that parameters id? Thanks in advance for any help!
If the category IDs do not change over time:
if($_GET['category_id'] == "1" ){ echo 'class="selected"'; }
If the categorie IDs are subject to change over time, you will need to perform a pre-query to get a map of category IDs to pages. Then you can do something like:
if($_GET['category_id'] == $categories['home_page'] ){ echo 'class="selected"'; }
<?php if($category['cat_id']==$_GET['cat_id']){ echo 'class="selected"';}?>
I have a mysql select and it spits out all the results in a <ul> that I have setup in a for loop. This works great. However, I wanted to have a "click more" type link at the bottom of each result that opens in a modal box when clicked. I also got this working just fine. What doesn't work, however, is the data inside what is displayed inside the modal box. It displays the data correctly but it is from the first result no matter what result you click. I thought I just didn't have my for loop setup correctly but it works when I change the id of the div the content is in for the modal box (but then the modal box doesn't work obviously).
Is there some reason why hiding a div would mess a for loop up as far as which row to display?
Below is the for loop
for($i=0; $i<$num_results; $i++)
{
$row = mysql_fetch_array($result);
?>
<div id='basic-modal'>
<ul style="background-color:#F5F5F5; padding:2px;">
<li class="program" style="font-size:18px;"><strong><?php echo trim ($row["program"]); ?></strong></li>
<li><strong>Sponsored by:</strong> <i><?php echo trim ($row["organization"]); ?></i></li>
<li><strong>Discipline:</strong> <?php echo trim ($row["discipline"]); ?></li>
<li><strong>Mission:</strong> <?php echo trim ($row["mission"]); ?></li>
<li><strong>Description:</strong> <?php echo trim ($row["content"]); ?></li>
<li><strong>Grade(s):</strong> <?php echo trim ($row["grade"]); ?></li>
<li><strong>Cost:</strong> <?php echo trim ($row["cost"]); ?></li>
<li> </li>
<li>Contact Info</li>
</ul>
<br />
<br />
</div>
<!-- pop up contact info -->
<div id="basic-modal-content">
<ul style="font-size:12px">
<li class="program" style="font-size:18px;"><strong><?php echo trim ($row["program"]); ?></strong></li>
<li><strong>Sponsored by:</strong> <i><?php echo trim ($row["organization"]); ?></i></li>
<li><strong>Contact Person:</strong> <?php echo trim ($row["contact"]); ?></li>
<li><strong>Contact Email:</strong> <?php echo trim ($row["email"]); ?></li>
<li><strong>Contact Phone:</strong> <?php echo trim ($row["phone"]); ?></li>
<li><strong>Contact Hours:</strong> <?php echo trim ($row["contactHours"]); ?></li>
</ul>
</div>
<!-- preload the images -->
<div style='display:none'>
<img src='images/x.png' alt='' />
</div>
<?php
}
?>
I'm using Eric Martin's SimpleModal if that makes a difference.
Thanks for the help.
You have same id of each div it is wrong