Copy link to clipboard
Copied
Hi
I need to show some news in a two column format. Left with a title, image and 300 caracters coming from {tag_description} and
he right column is a list of the rest of the news with title and 100 caracters from the description field.
I have created a webapps with the fields and creatred a testpage which contain this
<div id="content">
<div id="headline"">
<div id="news1-header">
</div>
<div id="news1-image">
</div>
<div id="news1-body">
</div>
</div>
<div id="news2">
<div id="news2-header">
</div>
<div id="news2-body">
</div>
</div>
<div id="news3">
<div id="news3-header">
</div>
<div id="news3-body">
</div>
</div>
<div id="news4">
<div id="news4-header">
</div>
<div id="news4-body">
</div>
</div>
</div>
<p>{module_webapps,27951,a,,,,true,10,,1}</p>
in the webapp presentation file, list-backup.html, I have put this script which should replace the innerhtml and output the text correctly
<script>
if ({tag_counter}==1){
document.getElementById('news1-header').innerHTML = '{tag_name}';
document.getElementById('news1-image').innerHTML = '{tag_image}';
document.getElementById('news1-body').innerHTML = '{tag_description}';
}
if ({tag_counter}==2){
document.getElementById('news2-header').innerHTML = '{tag_name}';
}
if ({tag_counter}==3){
document.getElementById('news3-header').innerHTML = '{tag_name}';
}
</script>
With this code, the page is blank, but when I delete the tag_description line, the output is ok!
If I only have the tag_description in the list_backup file, it output ok!
Any idea why this doesn't work?
Thank you
If you look at the code you'll find that the tag is actually rendering the HTML content:
The issue you have is that the JavaScript has an error in it:
The issue is that your content has single quotes in it '. The content you want to render with document.getElementById('news1-body').innerHTML = '{tag_description}'; must come between the 2 single quotes. If {tag_description} has a quote in it it breaks javascript.
I hope that helps!
-mario
Copy link to clipboard
Copied
Please post the URL of the frontend page you're seeing this issue on so that we can have a look at it.
-m
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If you look at the code you'll find that the tag is actually rendering the HTML content:
The issue you have is that the JavaScript has an error in it:
The issue is that your content has single quotes in it '. The content you want to render with document.getElementById('news1-body').innerHTML = '{tag_description}'; must come between the 2 single quotes. If {tag_description} has a quote in it it breaks javascript.
I hope that helps!
-mario
Copy link to clipboard
Copied
Don't suppose there are plans in the works to have webapps come with an option to display templates with entities escaped or can you already? Or just a default 'as json' template?
Copy link to clipboard
Copied
There are no such plans at the moment, Kenneth.
Copy link to clipboard
Copied
OK! so I scratch the news part? There is no workaround, solution to this? I need to ouput news with different formats, with first news with big headline, date, image, text in the left colum and a list of the other news in the right column! How do I do this?
Copy link to clipboard
Copied
No, there's no workaround currently for that.
Your other request I can't really understand. Do you need to display the detail of a web app and then display the list of web app items on the right side of it? Do you have an example of live site that does this so that we can get a better idea of your requirement?
-m
Copy link to clipboard
Copied
This is a section in the front page. How would you do this?
edit : Iin the left column, Lorem ipsum is {tag_description,500}
Thank you
Copy link to clipboard
Copied
That to me looks like a detail view of a web app where the left column is the detail of a web app item and the right column is a web app module placed inside the site-wide template that wraps around the detail view.
The only thing that's not possible is to exclude the item you are currently viewing from the list on the right.
-m
Copy link to clipboard
Copied
I've been working on this site for 4 months now, more than 80 pages, 12 000 members and they will send more than 120 000 emails per month with your system! I have many dead end problems (no pricing in booking, no sales tax in booking etc..). Look like 'No coding webapps' will get me out of business!
I need a solution to this simple problem.
Copy link to clipboard
Copied
Did you ever get and answer? I am trying to accomplish a similar look on some of my pages.
Copy link to clipboard
Copied
With the addition of the new module template system I have managed to do something
I have a .tpl for the Headline1 news with all the details
For the list that starts with headline2, I have added this code to a new .tpl file
<script type="text/javascript">
function skipnews(){
if ({tag_counter} == 1) {
document.getElementById("News").style.display = "none";
}
}
</script>
<div id="News">
<div id="NewsName"><strong>{tag_name}</strong></div>
<div id="NewsDate">{tag_releasedate}</div>
<div id="NewsReadMore">{tag_button,Read article} | ({tag_commentcount}) Comment(s)</div>
<br>
</div>
<script>skipnews();</script>
It manage to skip the first news in the list
Hope this will help
Michel
Copy link to clipboard
Copied
Thanks
Copy link to clipboard
Copied
Pricing on bookings you have a lot of control over with Javascript.
Varied pricing, multiple person booking, Amex surcharges... All possible.
Copy link to clipboard
Copied
The real answer would be Liquid, though, which is right around the corner, yes?????
Liam Dilley wrote:
Pricing on bookings you have a lot of control over with Javascript.
Varied pricing, multiple person booking, Amex surcharges... All possible.
Copy link to clipboard
Copied
Yes and know, this sort of manipulation in many systems you do with javascript these days. You do not want to process a form to a new page and back again etc if you was doing PHP to update details. You want to do that dynamically and on the fly.
Copy link to clipboard
Copied
That's why they invented ajax, which works just fine with php too...
Liam Dilley wrote:
You do not want to process a form to a new page and back again etc if you was doing PHP to update details. You want to do that dynamically and on the fly.
Though I suppose javascript is fine as long as there aren't any exploits that can be used to manipulate prices by rewriting the javascript. Because allowing that in a business-oriented SAAS platform would just be silly. An extra scripting layer would really be useful though. I can think of a few problems that could be solved if, say, I could generate salted hashes or use a local datastore or, you know, do anything you can do in Twig like filtering and logic and macros and define filter functions.
Copy link to clipboard
Copied
Way better though