How do I show PHP list in Intel XDK ListView?
<ul class="list widget uib_w_2 d-margins" data-uib="app_framework/listview" data-ver="1">
<li class="widget uib_w_8" data-uib="app_framework/listitem" data-ver="1">List Item</li>
</ul>
Here is my PHP:
<?php
for($i=0;$i<10;$i++)
{
?>
<li>List Item<?php echo $i;?></li>
<?php
}
?>
It's really unclear what you're trying to do, but, if you just want to make a simple unordered list in HTML with PHP, you're missing the <ul> and </ul> tags (use <ol> instead for a numbered list):
<ul>
<?php for ($i=0; $i<10; $i++): ?>
<li>List Item <?php echo $i;?></li>
<?php endfor; ?>
</ul>
Edit
It was misspelled in your post, but I think maybe you're looking for an "Intel XDK ListView"? If so, this guide seems to explain it pretty well, and here is a sample app using one. The ListView HTML you had pasted wasn't showing up because StackOverflow was interpreting it as HTML. If that code works and displays the single list item, just put the <ul class="..." ...> and </ul> tags outside of the for() block and repeat the inner <li> tag inside the loop adding in your <?php echo $i; ?>.
Related
I recently started learning AngularJS. When I getting data from the database an array, I using function foreach, so my code is
<ul>
<?php foreach($Items as $Item):?>
<li><?php echo $Item['name'];?></li>
<?php endforeach;?>
</ul>
I use AngularJS because I need sortable list elements. And my code with AngularJS roughly the
<script>
function PositionsList($scope){
$scope.positions=<?php echo json_encode($Items);?>
}
</script>
<ul>
<li ng-repeat="position in positions | filter:query">
<p>{{position.name}}</p>
</li>
</ul>
Is it possible to do so? If not, how to get the data received from server, If not use $http.post/get?
You can use ng-init to keep your model in a separate file:
<ul ng-init="positions = <?php echo htmlspecialchars(json_encode($Items)); ?>">
<li ng-repeat="position in positions | filter:query">
<p>{{position.name}}</p>
</li>
</ul>
I am trying to display something from my database on a bootstrap bar and I have no idea how to combine or implement the two. Ive made my bootstrap html's file a .php, was that the correct thing to do? Here's my code (ignore the filler words)
<ul class="nav nav-list well">
<li class="nav-header"></li>
<li class="active">HIT INFO</li>
<li>Linky link</li>
<li class="divider"></li>
<li>ANOTHER HIT INFO</li>
<li>ANOTHER LINKY LINK</li>
<li class="divider"></li>
<li>YET ANOTHER HIT</li>
<li>AAAAAnd another link</li>
</ul>
and this is the php i want to include (the code to making what i want to display is in the file)
<?php include 'one.php'; ?>
where "linky link" is, i want to display this but it didnt seem to work when i put that php right there. Another thing i want to do is when a link from the database gets displayed, it displays as a bootstrap button. i tried and am just not sure how to implement php code in my bootstrap code.
Print " <td>".$row['link'] . "</td></tr> ";
How would i add this bootstrap code to that so when a link from my database gets displayed, it gets displayed as this button
<i class="icon-heart icon-white"></i>Do this HIT!
Your code seems right to me except to your "<td> and <tr>" tag. You're not using it right.
Try this approach
In one.php
<?php
$links = array( 0 => array("url"=>"http://google.com","text"=>"Google") );
?>
In Menu
<?php include('one.php')?>
<ul>
<li>Menu one</li>
<?php foreach( $links as $link){ ?>
<li><a href="<?php print $link['url']?>"><?php print $link['text']?></li>
<?php } ?>
</ul>
My goal is to create a dynamic list of links next to each other (not on top of each other). So far I have the links outputting correctly using Simplepie and an Atom datasource but for some reason my output has a linebreak between each new item in the for each statement. Is it possible to skip the line break and put the output items next to each other instead? I am not getting any errors, just not getting my goal output. Please help this is making me age at an exponential rate :)
<body>
<?php
foreach ($feed->get_items() as $item):
?>
<div class="item"><?php echo $item- >get_title(); ?></div><?php endforeach; ?>
</body>
Put the links in a <ul> (Unordered list element) with style of float:left like so
<body>
<ul>
<?php
foreach ($feed->get_items() as $item):?>
<li class="item"><?php echo $item- >get_title(); ?>
</li>
<?php endforeach; ?>
</ul>
</body>
I'm trying to build a kiosk on a local machine, so no online requirement. I am going to build a big menu which will show exhibition stores and products. Due to the stores and products will always change, the client has requested to use a simple text file - .txt to populate the menu.
I used jQuery last week but unfortunately it didn't work. So after searching I've decided to use php instead. I'm new to php, but I have given it a try today, I have only managed to populate one list with the external file kate.txt
Here is my code for the page
<body>
<ul class="sf-menu">
<li class="current">
Area1
<ul>
<li class="current">
Kate
<ul>
<?php
//variables
$dir = "C:\wamp\www\Menu";
$txtfile="Textfiles\kate.txt";
foreach (glob("$txtfile") as $filename) {
$file = $filename;
$contents = file($file);
$string = implode("<li>", $contents);
}
?>
<li><?php echo $string ?></li>
</ul>
</li>
<li>
Cathy
<ul>
<li>Banana</li>
<li>Apple</li>
</ul>
</li>
</ul>
</li>
<li>
Area2
<ul>
<li>
lily
<ul>
<li>Watermelon</li>
<li>Grapefruit</li>
</ul>
</li>
<li>
John
<ul>
<li>Orange</li>
<li>Pineapple</li>
</ul>
</li>
</ul>
</li> <!--current-->
</ul> <!--sf-menu-->
</body>
Can someone please give me some direction on the php code? I don't mind how the text files are structured in a folder, as long as I can populate all the menu list items and links with a text file or multiple text files not in the html code.
Assuming that your text file holds all your list items
kate.txt:
<li>stuff</li>
<li>stuff</li>
...
the php file
<?php
$txtfile="Textfiles\kate.txt";
$content = file_get_contents($txtfile);
<li class="current">
Kate
<ul>
<?php echo $content ?>
</ul>
</li>
I'm having a hard time trying to figure out the dynamic sidebar without hacking the php file. I'm rebuilding an old web site and I need to use custom HTML code instead of the generate code that's given in wp-includes/nav-menu-template.php.
In a nutshell, I need to go from:
<div>
<ul>
<li>LINK NAME</li>
<li>LINK NAME</li>
<li>LINK NAME</li>
<li>LINK NAME</li>
</ul>
</div>
To this code:
<div>
LINK NAME
LINK NAME
LINK NAME
LINK NAME
</div>
For what you want you can create custom menu in admin as you did. Than in page where you want this paste this code:
<div>
<?php
$items = wp_get_nav_menu_items("custommenu");
foreach($items as $item):
?>
<?php echo $item->title; ?>
<?php endforeach; ?>
</div>
Replace custommenu with your menu name.