MODx template variable is link to an image jpg but doesnt show - modx

I have a template variable in MODx EVO and its called image-link.
The URL of the images are something like... http://www.friendssite-image5.jpg.
In my HTML I have this:
[[if? &is=`[+image-link+]:not_empty` &then=`
<div class="image-link">
<a href="[~[+id+]~]"><img alt="[*longtitle*]" src=
"[+image-link+]"></a>
</div>`]]
I tried setting the template variable as URL , also as image, and also as text, but the image does not want to appear. How can I solve this?

I noticed that you have your tags mixed between [+...+] and [...]. The "+" signs are for use with Ditto, but if you are placing the call directly in your document, use the "*" signs instead.
Example
Change:
[[if? &is=`[+image-link+]:not_empty` &then=`
<div class="image-link">
<a href="[~[+id+]~]"><img alt="[*longtitle*]" src=
"[+image-link+]"></a>
</div>`]]
To:
[[if? &is=`[*image-link*]:not_empty` &then=`
<div class="image-link">
<a href="[~[*id*]~]"><img alt="[*longtitle*]" src=
"[*image-link*]"></a>
</div>`]]

Related

how can i store html tags in mongo data base and display in ejs

I have post my html elements to data base like this
<article>
<h1> <span> text editors</span></h1>
<h2>برامج بنستخدمها عشان نكتب الكود بتاعنا وفي اضافات كتيرة بتسهل الشغل بتاعنا -</h2>
<h2>
<a target=_blank href="https://atom.en.uptodown.com/windows">Atom</a> وتاني برنامج هو <a target=_blank href="https://code.visualstudio.com/download">VS Code</a> عندك برنامجين حلويين جدا اول برنامج -
</h2>
<h2><a target=_blank href="https://code.visualstudio.com/download">للتحميل اضغط هنا</a> VS Code في الشرح بتاعنا هنستخدم -</h2>
<h2>زي الفيديو وبعد نفتح البرنامج عادي install بعد كدا هنعمل -</h2>
</article>
and I have get these data to my website. I need away to display the html in ejs. I tried many things but nothing works. I tried to dom-parse and it returns one element.
It's not a good idea to store complete elements in your DB, cause you might need to change the styling or the structure later.
What you can do instead, is store the data inside each of the tags in your DB, fetch the data when your site loads, and then add it to the elements.

How do I include a JS variable in an EJS file in a GET request?

I am trying to write an ejs file with a for-each loop that displays, as text, names of javascript variables line by line. I want each name to be hyperlinked to a route, such as /getinfo, that renders a page that displays more information about the variable that was clicked on.
I tried to use an "a href" tag as follows:
<a href="/getinfo?name=" <%= variable.name>> <%= variable.name %></a>
I expected variable.name to be included in the URL's query parameters, but it won't be appended properly. Considering how HTML does not support string concatenation, I am not sure how to properly include this data in an HTTP GET request.
What would be a correct way to achieve this? Thank you!
It's simple. Using template literal
<a href="<%= `/getinfo?name=${variable.name}${variable.name}` %>">
Regular ejs to output escaped html
<a href="/getinfo?name=<%= variable.name %><%= variable.name %>">

Magento - Change links in header

I just started with magento. I try to replace the header links on the default page. I need to replace the text "My Cart" with the following font-awesome icon.
<i class="fas fa-shopping-cart"></i>
But I have no clue where I can change this, the documentation is complicated and not very beginner friendly.
I figured it out. You have to create your own design and assign it in the backend . Then you have to create the following folder structure if it does not exist yet.
\app\design\frontend\yourDesign\default\template\page\template
Now create a file called links.phtml with the following content:
<ul class="links"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
//insert links here
</ul>

Angular2 loop through array within object

I got an object project which contains some properties and an array, when I try to loop trough it like this it's not working:
<img *ngFor="let image of {{project?.acf.images}}" src="{{image.image.url}}">
When I display it like this: {{project?.acf.images[0].image.url}}, it perfectly shows the url. Anything wrong with my syntax?
Interpolation is not needed in NgFor directive:
<img *ngFor="let image of project?.acf.images" src="{{image.image.url}}">

Changes to _settings.scss not showing

Changes made to _settings.scss does not seem to take effect. I am running compass watch on the project and can see that it is notified on the changes made.
Let me take an example:
If I uncomment and change the line
// $crumb-slash: "/";
to
$crumb-slash: "-";
as seen in their docs, and then use breadcrumbs in my html, such as
<nav class="breadcrumbs" role="menubar" aria-label="breadcrumbs">
<li role="menuitem">foo</li>
<li role="menuitem" class="current">bar</li>
</nav>
I will still see a slash instead of a dash.
Do I need to do anything to enable my _settings.scss?
EDIT:
Also worth mentioning is the fact that I get deprecation warnings from compass, regarding lines in _global.scss.
seems like you have some weird html. Inside you don't have to use , so try an html like this:
<nav class="breadcrumbs">
Home
Features
<a class="unavailable" href="#">Gene Splicing</a>
<a class="current" href="#">Cloning</a>
</nav>
I just saw in source that the slash in foundation/components/_breadcrumbs.scss that the slash is hardcoded in one line:
/* Accessibility - hides the forward slash */
[aria-label="breadcrumbs"] [aria-hidden="true"]:after {
content: "/";
}
Maybe this causes problems for you? maybe a bug?

Resources