I am running MODX Revo 2.3.2 with Articles and getResources. On my start page, I wan't to show the 4 most recent articles by calling getResources. However, it does not show the image. Tried to output it without phpThumbof, but it does not work out at all.
[[getResources?
&parents=`11`
&tpl=`articleRowTpl`
&includeTVs=`1`
&processTVs=`1`
&showHidden=`1`
&limit=`4`
]]
My articleRowTpl looks like this:
<article class="blog-item blog-full-width">
<div class="blog-thumbnail">
<img alt="" src="[[+tv.articleImage:phpthumbof=`w=750&h=200&zc=1`]]">
</div>
<div class="blog-full-width-date">
<p class="day">[[+publishedon:strtotime:date=`%d`]]</p><p class="monthyear">[[+publishedon:strtotime:date=`%b %Y`]]</p>
</div>
<div class="blog-content">
<h4 class="blog-title">[[+pagetitle]]</h4>
<p>[[+introtext:default=`[[+content:ellipsis=`400`]]`]]</p>
Mehr lesen...
</div>
</article>
There are no errors, it just does not output the image path. I double checked the placeholder and the prefix, which defaults to tv. as the documentation says.
Alright, found it. I just removed the TV-Prefix of getResources with
tvPrefix=``
and now I can access the TV with [[+articleImage]].
Related
I have the following code which loops through a list of countries and creates a href links
<div class="container" th:each="country: ${countryList}">
<a th:href="${country.countryAbbr}"><div clss="row" th:text="${country.country}"></div></a>
</div>
The current page url is "localhost:8080/directory", and the generated url is showing as
"localhost:8080/us"
How can I make the url show as "localhost:8080/directory/us"
I want "us" to be added to the current url of the page.
Try create the following code in your Controller class.
#RequestMapping(value="/", method=RequestMethod.GET)
public String rootGet() {
return "redirect:/directory";
}
You can use ServletUriComponentsBuilder:
<div th:with="urlBuilder=${T(org.springframework.web.servlet.support.ServletUriComponentsBuilder)}"
class="container" th:each="country: ${countryList}">
<a th:href="${urlBuilder.fromCurrentRequest().path(${country.countryAbbr}).toUriString()}">
<div clss="row" th:text="${country.country}"></div>
</a>
</div>
Give a try to this one
<div class="container" th:each="country: ${countryList}">
<a th:href="#{${country.countryAbbr}}"><div clss="row" th:text="${country.country}"></div></a>
</div>
Using # usually resolves the default context but I am not aware of your environment.
For example, if you had Tomcat .war file, and your application would be hosted at localhost:8080/myApp, you would want result /myApp/us rather then /us. # would do that trick.
If above is not relevant for you, use this one:
<div class="container" th:each="country: ${countryList}">
<a th:href="#{'/directory/' + ${country.countryAbbr}}"><div clss="row" th:text="${country.country}"></div></a>
</div>
I was trying to use HTMLAgilityPack to manipulate some Html. I decided to try CSQuery as well.
The goal is to extract and img tag and it src and reinsert it in front of an h3 tag.
Assume html:
<div class="col-md-6">
<div class="item">
<div class="content galleryItem">
<h3>
Al Shabaab kill at least 29 in latest attacks on Kenyan coast
</h3>
<p> <img alt src="../../../../images/AlShabaab.jpg"></p>
<p>
Al Shabaab killed at least 29 people in two coastal areas of Kenya.</p>
</div>
</div>
</div>
Goal is to move the img in front of the h3
I used the following to strip the style attr from img tags:
Dim csq = CQ.Create(input)
Dim csstyle = csq("img")
Return csstyle.RemoveAttr("style")
Since you did not explicitly tag this VB.NET I'll answer in C#, I hope that's OK:
var cq = CQ.create(input); // create the CsQuery source
var img = cq["img"]; // image here, img["src"] is its source
img.Remove().InsertBefore(cq["h3"]);// remove it, and add it in front of H3.
of course this code can be shorter, but I wanted the code to match your literal description.
Hi I'm trying to convert a static html and css design to a blogger template. I've run into an issue where i expect the post includable to return the post title but instead is returning the blog title. Here is the includable code for the post and below it is the include code that is called in the main includable that houses the html structure. Please any ideas as to how i might resolve this would be very grateful.
<b:includable id='post' var='post'>
<!--Article Summary-->
<b:if cond='data:post.title'>
<h1 class="article-title">
<data:post.title/>
</h1>
<b:else/>
<h1 class="article-title">
<data:post.title/>
</h1>
</b:if>
<p class="posted-by">
by
<em class="author-name"><data:post.author/></em>
on
<span class="date"><data:post.dateHeader/></span>
</p>
<p class="article-content">
<data:post.body/>
</p>
READ MORE
</b:includable>
<b:if cond="data:blog.url == data:blog.homepageUrl">
<div class="article-summary">
<img class="article-image" src="https://lh3.googleusercontent.com/article-main-image.jpg" alt="article-main-image"/>
<b:include name="post"/>
</div>
</b:if>
is correct, so instead I'd be curious about whether or not you're including from the right place. For example, are you in the MOBILE section vs the NON-MOBILE section of the template?
Can I use gr:category and rdf:type from product ontology together?
I see vso:Canoe from automobile ontology...
<div typeof="gr:SomeItems vso:Canoe" about="#product">
<span property="g:name">ACME Foldable Canoe</span>
<div property="gr:category" content="Outdoors/Boats/Canoes"></div>
</div>
However I'm using productontology,is this possible?
<div about="#myObject" typeof="http://www.productontology.org/id/Canoe">
<div rel="rdf:type" resource="http://purl.org/goodrelations/v1#SomeItems"></div>
<div property="gr:description" xml:lang="en">... a longer description ...</div>
<div property="gr:name" xml:lang="en">.. a short name for the object ...</div>
<div property="gr:category" content="Outdoors/Boats/Canoes"></div>
</div>
Yes, that is well possible and increases a client's ability to understand your data.
So
<div about="#myObject" typeof="http://www.productontology.org/id/Canoe">
<div rel="rdf:type" resource="http://purl.org/goodrelations/v1#SomeItems"></div>
<div property="gr:description" xml:lang="en">... a longer description ...</div>
<div property="gr:name" xml:lang="en">.. a short name for the object ...</div>
<div property="gr:category" content="Outdoors/Boats/Canoes"></div>
</div>
is perfectly valid.
There is currently no official statement from major search engines on the ways they honor additional type information, but it is a safe assumption that
it does not harm adn
the more data of this form is out there, the more it will matter for search engines.
Yes, you can use types and properties from any namespace in RDFa (and RDF in general). In the case of your snippet, you could even get rid of the rdf:type line since #typeof accepts multiple types from any number of namespaces, and those types can be in the form of CURIEs or full URIs (same applies to #property). So your snippet would become:
<div about="#myObject" typeof="http://www.productontology.org/id/Canoe gr:SomeItems">
<div property="gr:description" xml:lang="en">... a longer description ...</div>
<div property="gr:name" xml:lang="en">.. a short name for the object ...</div>
<div property="gr:category" content="Outdoors/Boats/Canoes"></div>
</div>
I have the following code:
{#data.merchantModel}
<div class="address">
{#content $key="content:combinedAddr" merchantAddress1="{merchantAddress1}" merchantAddress2="{merchantAddress2}"/}
</div>
{:else}
<div class="address">{merchantAddress1}</div>
more code...
{/data.merchantModle}
I'm working with Webcore/NodeApp but everything after the {:else} doesn't get rendered. If I comment it out everything is fine. Not sure why webcore doesn't like the {:else} but was wondering if there's another way to write the above code?
Still trying to wrap my head around dust.
Looks like you need to close your content tag and model is misspelled on the closing tag:
{#data.merchantModel}
<div class="address">
{#content $key="content:combinedAddr" merchantAddress1="{merchantAddress1}" merchantAddress2="{merchantAddress2}"/}
</div>
{:else}
<div class="address">{merchantAddress1}</div>
more code...
{/content}
{/data.merchantModel}