Announcement

Collapse
No announcement yet.

Assign an image file to a variable?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Leanne
    replied
    So glad you finally have a resolution to this pesky problem :)

    Leave a comment:


  • cpp-dev
    replied
    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'">
    It's really just the latter half of your solution.

    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
    Last edited by cpp-dev; 02-23-21, 04:50 PM. Reason: Formatting

    Leave a comment:


  • Leanne
    replied
    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:


  • cpp-dev
    replied
    Originally posted by Gordon - Phosphor Media View Post

    HTML Code:
    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
    Ahhhh! ok, yeah there is a base --
    Code:
    base href="https://www.californiapetpharmacy.com/mm5/"

    Leave a comment:


  • cpp-dev
    replied
    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:


  • Leanne
    replied
    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:


  • Bruce - PhosphorMedia
    replied
    Originally posted by cpp-dev View Post

    Hmm. Maybe I can illustrate the idea more clearly

    Yea, I think you are going to need to hire an integrator/developer to get this done as there are too many variables (and not in the coding sense) at play here to work out in a forum post. Sorry.

    Leave a comment:


  • Gordon - Phosphor Media
    replied
    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:


  • cpp-dev
    replied
    Originally posted by Bruce - PhosphorMedia View Post

    Sorry, not following.
    Hmm. Maybe I can illustrate the idea more clearly

    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:


  • cpp-dev
    replied
    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:


  • Bruce - PhosphorMedia
    replied
    Originally posted by cpp-dev View Post
    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.
    Sorry, not following.

    Leave a comment:


  • cpp-dev
    replied
    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:


  • cpp-dev
    replied
    Originally posted by Gordon - Phosphor Media View Post
    This may seem elementary, but do you have a base href defined in the head of that page?
    Sorry I don't quite follow. What do you mean by "base href"?

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    [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')" />
    Nah, that function call has nothing to do with what I think you are trying to accomplish and the function expects a variable specifying and image type (and surprised it compiled) a variable var to load resulting information.

    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;
    Note: Not sure about "l.settings:navigationitem:link_dest" as containing the code cause i rarely use navigation sets, but its whatever variable contains the category code.

    Leave a comment:


  • Gordon - Phosphor Media
    replied
    This may seem elementary, but do you have a base href defined in the head of that page?

    Leave a comment:

Working...
X