Announcement
Collapse
No announcement yet.
Assign an image file to a variable?
Collapse
X
-
Leanne you're the winner! you and the dev team came up with nearly identical solutions here's their version of line 18
Code:<mvt:if expr="l.settings:navigationitem:name EQ 'Bravecto'">
As a side note here's another bit of knowledge they dropped on me.Pages -link_type = G Products -link_type = P Categories -link_type = C URL -link_type = U
Leave a comment:
-
Line 18 doesn't look right. Try:
Code:<mvt:if expr="l.settings:navigationitem:link_type EQ 'P' AND l.settings:navigationitem:name EQ 'Bravecto'">
Leave a comment:
-
Leanne I think you're on to something.
This is where I am now:
Screenshot 2021-02-23 142135.png
I'm not any worse off, but I'm not any better off either.
Leave a comment:
-
I think the problem is that you're trying to load a category tree image for an element that is not actually a category, and therefore doesn't have a category tree image assigned to it. I would create an image to represent the brand, save it with the same name as your link (i.e. Bravecto.jpg) and put it in a dedicated folder on your server just for these types of pages. Run a conditional that checks for the page name in the link text, and if it matches, assign the /my-special-directory/my-page-name.jpg image to the variable that displays the category tree image. Or am i missing something bigger that means this wouldn't work?
Leave a comment:
-
Originally posted by cpp-dev View Post
Hmm. Maybe I can illustrate the idea more clearly
Leave a comment:
-
Originally posted by cpp-dev View Post
Sorry I don't quite follow. What do you mean by "base href"?HTML Code:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
Leave a comment:
-
Originally posted by Bruce - PhosphorMedia View Post
Sorry, not following.
So navigation sets in the Levels theme are designed to work from Categories. Categories have specific fields, one of these is a field for an image. I pretty sure you know this, but included for completeness.
(see image)
miva-category-tree-img.png
The product brand has a several subcategories. But a category page doesn't display the sub categories is a meaningful way. Best I could figure was to have all the products be visible, which was a jumbled mess.
So I created a custom page, which has a single navigation set item, which displays the desired categories in a nice layout, and makes it simple for the user to move up and down the category tree. (see image)
crafted-category-page.png
All is well ... except that on the affiliate/partner page where we have a specific collection of categories for the partnered members, that is being displayed through a navigation set. With a little commenting of the template code we got the navigation set to show the link to page along with the categories. But it looks extra odd, because it doesn't have an image. (see image)
miva-category-navset-display.png
SO, the end goal is to create the variable that the template code expects, and have it point to a file on the server. Ideally the template code will read the variable and display the desired file.
If we can get this to work I'm planning on reusing this pattern in another navigation set.
Leave a comment:
-
I've been continuing to search the Miva API page and I saw this Miva Docs: ProductImage_Insert
seemed promising, but seem still not quite right:
Code:<mvt:do file="g.Module_Library_DB" name="l.success " value="ProductImage_Insert('graphics/00000001/logo-bravecto-main.png' 'l.settings:navigationitem:category:catt ree:image')" /> &mvte:local:settings:navigationitem:category:cattree:image;
Leave a comment:
-
Originally posted by cpp-dev View PostBruce - PhosphorMedia This looks really close. The thing that seems to be tripping this up is that thing I'm linking to is just a page. But I'm wanting the link and image to appear in a navigation set, which contains categories.
Leave a comment:
-
Bruce - PhosphorMedia This looks really close. The thing that seems to be tripping this up is that thing I'm linking to is just a page. But I'm wanting the link and image to appear in a navigation set, which contains categories.
Leave a comment:
-
[QUOTE=cpp-dev;n711687]Still muddling though.
I thought maybe something with 'mvt:do' like: (based on Miva Docs: Image_Load_File)
Code:<mvt:do file="g.Module_Library_DB" name="l.settings:navigationitem:category:cattree:image" value="Image_Load_File('graphics/00000001/logo-bravecto-main.png')" />
I think you want to just use:
Code:<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code(l.settings:navigationitem:link_dest, l.settings:thisCat)" /> <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:thisCat:id, l.settings:thisCatInfo)" /> &mvt:thisCatInfo:image;
Leave a comment:
-
This may seem elementary, but do you have a base href defined in the head of that page?
Leave a comment:
Leave a comment: