I want building a form like that:
<div> test </div>
// show me all categories from table
<div class="section">
{{#categories}}
{{{.}}}
{{/categories}}
</div>
// show me all books from table>
<div class="section">
{{#books}}
{{{.}}}
{{/books}}
</div>
Each books or categories has div tag.
i want that each tag start on new page.
Can you tell me how can i insert new page in mustache.
Best Regards,
I found something:
From html is posible, something like <p style="page-break-after:always;"></p>.
After this line, new page is made.
Related
I have a PHP page that is pulling data from a MySQL table. One field (content) contains HTML to populate on the page. When trying to insert the record inside of a paragraph tag, the result starts and ends with a paragraph tag, but does not insert correctly as a child element, but as a sibling. Can anyone see the issue here?
HTML/PHP
<?php
foreach ($pages as $page) {
?>
<div class="slide" id="about-content">
<h1 class="pic-title"><?=$page->title;?></h1>
<p class="pic-caption overlay">
<?=$page->content;?>
</p>
</div>
<?php
}
?>
Output HTML:
<div class="fp-tableCell" style="height:419px;">
<h1 class="pic-title" style="margin-left: 25px;">Splash Page 2</h1>
<p class="pic-caption overlay" style="display: block;">
</p>
<p>dfajdfn<strong>akdjfnas</strong></p>
<p></p>
</div>
MySQL Data:
Title: Splash Page 2
Content: <p>dfajdfn<strong>akdjfnas</strong></p>
I can't seem to trace this one. Thanks!
That's to be expected, you're inserting a <p> inside another <p>. You can NOT nest paragraphs, and starting a new paragraph while inside a paragraph will terminate the earlier one.
e.g.
<p>foo
<p>bar
<p>baz
will internally generate
<p>foo</p>
<p>bar</p>
<p>baz</p>
In the DOM tree.
You should probably switch to using <div> instead:
<div class="pic-caption overlay">
^^^---
<?=$page->content;?>
</div>
^^^
I've created a Joomla template (3.2). and my each page type has different class like, All article pages have article class, and contact us page have contact-us class
<!--For About us page -->
<div class='container article'>
...
</div>
<!--For Contact us page -->
<div class='container contact-us'>
...
</div>
and so on.. so is there any way to get this thing done ?
I am not preferring to create a template for each page..
You could get part of the url and if it contains some specific words, you can make an if () else (if ()else()) printing those divs or a case if you want more options
If you want to specifically identify a page type, you'll need to know the component and the view being displayed. If you're in the template file, you can get these like this:
$input = JFactory::getApplication()->input;
$component = $input->get('option');
$view = $input->get('view');
These are just strings so using them as a class is as simple as something like this:
<div class="container <?php echo $component, '-', $view; ?>" >...</div>
Which should give you something like this:
<div class="container com_content-article" >...</div>
When the page is an article view of the com_content component.
First set class name in one variable using different condition and then append this value in class attribute. like following:
<?php
$input = JFactory::getApplication()->input;
$view = $input->get('view');
$container_class=$view;
// also add more condition and set $container_class
?>
<!--For About us page -->
<div class='container <?php echo $container_class; ?>'>
...
</div>
So I'm trying to set mPDF on my site, but the thing is, on the page that I want to create pdfs on, I get all of the content inside divs based on the posts count. So it looks something like this:
<div id="all-posts">
<div id="some-post">
content
</div>
<div id="some-other-post">
content
</div>
<div id="post-with-long-title">
content
</div>
</div>
And then I have a select, with options values which are equal to the div IDs inside all-posts. And when you pick an option from the select, that div is showed. Now what I need to do is show a Save PDF button, and when that is clicked, get the content from the div that is currently showing (based on whats selected in select tag) and save the .pdf. Is something like this even possible?
Update:
<?php include("mpdf/mpdf.php");
$mpdf=new mPDF();
ob_start(); ?>
<div id="all-posts">
<div id="some-post">
content
</div>
<div id="some-other-post">
content
</div>
<div id="post-with-long-title">
content
</div>
</div>
// Now collect the output buffer into a variable
<?php $html = ob_get_contents();
ob_end_clean();
$mpdf->WriteHTML($html);
$mpdf->Output();
exit; ?>
Quick version: How do I output a taxonomy term ID in a views template? I just want the numeric ID value. This will be used as a link anchor.
Long version:
Scenario, I have a view which displays a list of taxonomy terms. That view has a Page and a Block. The Page view is set to display the Block view as a header. That Block view simply contains the taxonomy names. The Page view displays all of the taxonomy content.
I want the Block view list to anchor to the items in the Page view:
This view is already built, the missing part of the equation is getting the anchor links in place.
The view currently comprises 3 custom template files:
views-view-fields--categories--page.tpl.php
<article id="NEED THE TERM ID HERE">
<header>
<h2 class="flag-heading"><?php print $fields['name']->content; ?> <span>in association with <?php print $fields['field_sponsor']->content; ?> </span></h2>
</header>
<div class="table">
<div class="table-cell">
<?php print $fields['field_category_image']->content; ?>
</div>
<div class="table-cell">
<?php print $fields['description']->content; ?>
</div>
</div>
</article>
views-view-fields--categories--block.tpl.php
<li><?php print $fields['name']->content; ?></li>
views-view--categories--block.tpl.php
<ul>
<?php print $rows; ?>
</ul>
I've tried using a views contextual filter rewrite on the top block view links, with no luck.
All I need is the variable for the TERM ID - I've done a var dump of the available variables, I can see the TID in that list, but have no idea how to reference it in a views-view-fields template file and can find nothing online that answers this most simple of concepts.
Screenshots of the Page and Block view setup:
Finally won my argument that this jump list is completely redundant and stupid, so it'll be removed, however, I did manage to output the TID, which was fairly obvious, as these things often are...
views-view-fields--categories--block.tpl.php
<li>
<?php print $fields['name']->content; ?>
</li>
views-view-fields--categories--page.tpl.php
<article id="cat<?php print($view->result[$view->row_index]->tid); ?>">
<header>
<h2 class="flag-heading"><?php print $fields['name']->content; ?> <span>in association with <?php print $fields['field_sponsor']->content; ?> </span></h2>
</header>
<div class="table">
<div class="table-cell">
<?php print $fields['field_category_image']->content; ?>
</div>
<div class="table-cell">
<?php print $fields['description']->content; ?>
</div>
</div>
</article>
The variable is obviously in the view array, it was just a case of getting the index of the current view item.
Adding
<?php print $fields['tid']->content; ?>
should give you the TID in views-view-fields--xxx--page.tpl.php and --block.tpl.php
Make sure the fields are set to remove any default wrappers and you should be good to go.
I am currently new to php.I am trying to display results from a database to the same html page.However am not using a form for searching,the search is universal.How can i display the results in same page?
For example heres a part of my html page
<body>
<div class="div1>
button to display results
</div>
<div class="div2">
</div>
and in my php everything is working fine.However i want when a user clicks the "button to display results" link,the results from the database should be displayed in div2.Help will be highly appreciated.
Try this: it will cause the page to refresh passing 1 to the query string to indicate whether to display or not
<div class="div1>
button to display results
</div>
<div class="div2">
<?php
$display = $_GET['display'];
if($display)
{
//do some dispaly here
}
?>
</div>