How do you access the value of a global theme option of type "file?"

Christian Santiago's Avatar

Christian Santiago

20 Sep, 2011 08:27 PM

I am having an issue finding the URL of the asset when uploaded through the global theme options in my template code. I have a global theme option called "Featured Image." In my config.yaml, I gave it a tag FeaturedImage. When attempting to access it with this tag, I get unexpected results. What I am after is the URL of the uploaded asset. Is there something I am missing?

  1. Support Staff 1 Posted by Byrne Reese on 21 Sep, 2011 12:04 AM

    Byrne Reese's Avatar

    There is no such thing as a global theme option. There are global plugin options, but themes are inherently blog specific. Can you share with us an excerpt from your config.yaml?

  2. 2 Posted by Christian Santi... on 21 Sep, 2011 12:14 AM

    Christian Santiago's Avatar

    Yep: Here is the relevant portion of the config.yaml:

    id: 'gi_theme_pack'

    key: 'gi_theme_pack'

    name: 'GI Theme Pack'

    description: 'Themes for the GI Intranet'

    author_name: 'GI Intranet Redesign Team 2011'

    author_link: ''

    version: 1.3

    static_version: 1.3

    blog_preferences:

        giWebconfig:

            label: "Recommended configuration settings for blogs using the
    themes in the giWeb Theme Pack"

            description: "It is highly recommended to use these settings."

            order: 100

            preferences:

              use_comment_confirmation: 1

              autolink_urls: 1

              allow_comment_html: 1

              email_new_comments: 1

              include_system: shtml

              allow_anon_comments: 1

              allow_unreg_comments: 1

              commenter_authenticators: MovableType

              follow_auth_links: 1

              moderate_unreg_comments: 0

              nofollow_urls: 1

              sort_order_comments: ascend

              require_comment_emails: 0

              captcha_provider: null

              entry_status: published

    options:

      fieldsets:

        other_blogs:

          label: 'Other Blogs'

          hint: 'The theme pack needs to know about certain other blogs on this
    installation so it can properly link to them and/or fetch content from them'

        features:

          label: 'Features'

          hint: 'A carousel in the right column of all GI Themes displays image
    ads. Up to four can be displayed, but using all is not required.'

      gi_home:

        type: blogs

        label: "GI Intranet Home"

        hint: "This is the GI Intranet Home Page Blog"

        tag: GIHome

        fieldset: other_blogs

        scope: system

      gi_staff:

        type: blogs

        label: "GI Staff Blog"

        hint: "For GI Staff section Blog"

        tag: GIStaff

        fieldset: other_blogs

        scope: system

      gi_offerings:

        type: blogs

        label: "Informatics Offerings"

        hint: "Informatics Offerings on the GI Intranet Blog"

        tag: GIOfferings

        fieldset: other_blogs

        scope: system

      gi_support:

        type: blogs

        label: "Support"

        hint: "Support and Systems Alerts Blog"

        tag: GISupport

        fieldset: other_blogs

        scope: system

      gi_tips:

        type: blogs

        label: "Tips Tricks and Training"

        hint: "Tips Tricks and Training Blog"

        tag: GITips

        fieldset: other_blogs

        scope: system

      featured_image_1:

        label: "Featured Image #1:"

        type: file

        fieldset: features

        tag: FirstFeaturedImage

        order: 1

      featured_image_2:

        label: "Featured Image #2:"

        type: file

        fieldset: features

        tag: SecondFeaturedImage

        order: 2

      featured_image_3:

        label: "Featured Image #3:"

        type: file

        fieldset: features

        tag: ThirdFeaturedImage

        order: 3

      featured_image_4:

        label: "Featured Image #4:"

        type: file

        fieldset: features

        tag: FourthFeaturedImage

        order: 4
    When I attempt to publish a template with this set of tags:

    *<MTFirstFeaturedImageAsset>**<MTAssetURL>**</MTFirstFeaturedImageAsset>*

    I get this error:

    Can't locate object method &quot;get_config_value&quot; via package
    &quot;MT::Component&quot;

    This particular install of movable type runs on a mysql database.

  3. Support Staff 3 Posted by Byrne Reese on 21 Sep, 2011 12:19 AM

    Byrne Reese's Avatar

    Bingo bango! Is this plugin/theme in the addons folder or plugins folder? I think it needs to be a plugin.

    On Tuesday, September 20, 2011 at 5:13 PM, Christian Santiago wrote:
    >

  4. 4 Posted by Christian Santi... on 03 Oct, 2011 09:12 PM

    Christian Santiago's Avatar

    This has been deployed to the server in the plugins folder, not addons. Can I access the asset url from the plugin options?

  5. Support Staff 5 Posted by Dan Wolfgang on 05 Oct, 2011 01:18 PM

    Dan Wolfgang's Avatar

    According to the Config Assistant documentation you use your field's tag to create a block tag with "Asset" appended, which then gives you access to the normal asset tags. So, the following should do it:

    <mt:FirstFeaturedImageAsset>
        <mt:AssetURL>
    </mt:FirstFeaturedImageAsset>
    
  6. 6 Posted by Christian Santi... on 05 Oct, 2011 09:29 PM

    Christian Santiago's Avatar

    Hi Dan,

    Yes I did try that, but it returned an error when I tried to publish the
    template:

    Can't locate object method &quot;get_config_value&quot; via package
    &quot;MT::Component&quot;

  7. Support Staff 7 Posted by Dan Wolfgang on 11 Oct, 2011 07:06 PM

    Dan Wolfgang's Avatar

    Christian and I worked through this bug; the solution exists in Config Assistant version 2.2.6: https://github.com/openmelody/mt-plugin-configassistant/downloads

  8. Dan Wolfgang closed this discussion on 11 Oct, 2011 07:06 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac