Posted in site documentation
473
1:15 am, June 11, 2021
 

change this to a list group - other items

<p>Other item format is a bit average, list group should fix this.&nbsp;</p>
<p><img src="https://i.imgur.com/n9jxHZW.png" /></p>
<p>This uses the template:</p>
<p><code>core-list-item-simple.html&nbsp;</code></p>
<p>So we can change this a bit to the list group format.&nbsp;</p>
<p>Which is basically this layout</p>
<h4>HTML</h4>
<pre><code class="html hljs xml">&lt;ul class="list-group"&gt;<br />&nbsp; &lt;li class="list-group-item"&gt;An item&lt;/li&gt;<br />&nbsp; &lt;li class="list-group-item"&gt;A second item&lt;/li&gt;<br />&nbsp; &lt;li class="list-group-item"&gt;A third item&lt;/li&gt;<br />&nbsp; &lt;li class="list-group-item"&gt;A fourth item&lt;/li&gt;<br />&nbsp; &lt;li class="list-group-item"&gt;And a fifth one&lt;/li&gt;<br />&lt;/ul&gt;</code></pre>
<p>as i want it to be links, need to use the same classes and links instead.&nbsp;</p>
<h4>HTML</h4>
<pre><code class="html hljs xml">&lt;div class="list-group"&gt;<br />&nbsp; &lt;a href="#" class="list-group-item list-group-item-action active" aria-current="true"&gt;<br />&nbsp; &nbsp; The current link item<br />&nbsp; &lt;/a&gt;<br />&nbsp; &lt;a href="#" class="list-group-item list-group-item-action"&gt;A second link item&lt;/a&gt;<br />&nbsp; &lt;a href="#" class="list-group-item list-group-item-action"&gt;A third link item&lt;/a&gt;<br />&nbsp; &lt;a href="#" class="list-group-item list-group-item-action"&gt;A fourth link item&lt;/a&gt;<br />&nbsp; &lt;a href="#" class="list-group-item list-group-item-action disabled" tabindex="-1" aria-disabled="true"&gt;A disabled link item&lt;/a&gt;<br />&lt;/div&gt;</code></pre>
<p>Changed templates to use the list-group.html and list-group-item.html rather than the core templates.&nbsp;</p>
<h4>HTML - list-group-item.html</h4>
<pre><code class="html hljs xml">&lt;a href="/view/[@classname]/[@uid]/[@titleuid]/" class="list-group-item list-group-item-action" title='[@title]'&gt;[@title]&lt;/a<br /></code></pre>
<h4>HTML - list-group-card.html</h4>
<p>a list group inside a card to make it neater.&nbsp;</p>
<pre><code class="html hljs xml">&lt;div class='card mb-3'&gt;<br />&nbsp; &lt;h5 class='card-header'&gt;[@title]&lt;/h5&gt;<br />&nbsp; &lt;div class='card-body'&gt;<br />&nbsp; &nbsp; &lt;div class="list-group"&gt;<br />&nbsp; &nbsp; &nbsp; [@content]<br />&nbsp; &nbsp; &lt;/div&gt;<br />&nbsp; &lt;/div&gt;<br />&lt;/div&gt;</code></pre>
<p>Updated quite easily once i found the function.&nbsp;</p>
<p>Now it looks something like this:&nbsp;</p>
<p><img src="https://i.imgur.com/DxpO7Rh.png" /></p>
<p>Which is quite a lot nicer than the simple links and also better for mobile as you can press anywhere on the element, and makes it a bit more like buttons.&nbsp;</p>

PHP

if($class->category > " ") {
	$other_items_list_title = "Other Items in $class->category";
	$other_items_list = $class->list_all(
        $start = 0,
        $max = 50,
        $list_type = "category",
        $template_file = "list-group-item.html",
        $search_term = $class->category
      );

		$other_items_card_template = new template("list-group-card.html");
		$other_items_card_template->set("title", $other_items_list_title);
		$other_items_card_template->set("content", $other_items_list);
		$page_content .= $other_items_card_template->output();
}

View Statistics
This Week
214
This Month
1098
This Year
585

No Items Found.

Add Comment
Type in a Nick Name here
 
Related Search Terms
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
“We ought to take outdoor walks in order that the mind may be strengthened and refreshed by the open air and much breathing.".
Seneca
Latest News
## 🚀 AI Giants Hit Bullseye: Anthropic & OpenAI Achieve Product-Market Fit Anthropic and OpenAI have reached a significant milestone, finding product-market fit with their AI technologies, which means their products effectively meet the needs of their customers, driving growth and adoption. This achievement showcases the practical value of their innovations, enabling businesses and individuals to leverage AI for enhanced productivity and efficiency. With this alignment of product and market needs, these companies are poised to transform industries and shape the future of technology.