We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54629
    • 3 Posts
    Hi,

    I am a newbie to modx and now working on the conversion of a website. On the website there is also a section jobs and I want to define this as a TV (using Migx) attached to a template. However, this template is used by more pages but I only want to define it once. Not for every page it is attached to as a result of being a TV. Consider it as a global variable for the site, but not for every page. How to achieve this?

    Kind Regards, Louis

    config: nginx, php7.0 revo 2.5.6

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 46886
      • 1,154 Posts
      I am not positive but I just added a resource with an existing MIGX tv template, and it gave me an empty field, and I don't believe anything will show if you don't put anything in there.

      I did not realize that you could deploy the same tv on multiple resources, but it seems unwise to me anyway.
      • discuss.answer
        If you do not want to use a different template for jobs then you could use output modifiers to hide empty results on the front end but the variable will still show up in the manager.

        [[*mymigxtv:notempty=`[[!getImageList]]`]]
        • discuss.answer
          • 3749
          • 24,544 Posts
          As you say, TVs are for page-specific data. For site-wide data, create a new System Setting in System (gear icon) -> System Settings.

          You can display your setting on a page, or use it as the value of a snippet property with a setting tag:

          [[++setting_name]]
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 54629
            • 3 Posts
            Hi,

            Thank you for all the answers! Maybe I should be a little bit clearer. I am thinking of the manager interface where the site maintainer should be able to add new available jobs (eg title, text). So, one section for the jobs but the maintainer should also be able to manipulate some tv's which are properties of the individual pages. And moreover, as far as I can see it now I will have just one template for all the pages (about 10 pages in 10 different languages). I will use different chunks for each content part. And the TV (in different languages) as variables used in the chunks. For each language a separate context.

            I just tried it with a migx TV, attach it to the base template and it pops up at everypage.

            @nuan88 Do you mean when it's empty it will not show up a the manager frontend? I will not use the 'jobs' section on the individual pages anyway, except for the jobs page.
            @pyrographics I this is a way to disable or to hide TV for specific resources in in the management backend?
            @bobray I have been thinking about this as well, using the system settings but I cannot oversee yet how te present the maintainer just a section of the system settings and also nice interface to add, edit, delete new jobs descriptions.

            Have been looking around the forum and I came across this thread:

            https://forums.modx.com/thread/98802/global-template-variables

            And I am thinking of the solution user rx2 presented. I create a new Admin template, attach the jobs section (but also a slider config) to this and one empty admin page not used anywere. In this way creating one entry for the site maintainer to both manipulate the 'jobs' section and the slider. Let's say, a dummy template/page.

            But maybe I am completely missing the point a this moment I am not working for such a long time Modx and I can't oversee all the possibilities and I am making life to difficult. Bob Ray, I bought a copy of your book and I am going through but at the moment I am at page 215, so still much to learn.

            Nice system and fun to work with. But also with a lot of possibilities and freedom. So more solutions to the same problem, as I already noticed looking at other modx sites.

            So, now I go to the beach and I will take the Modx bible with me.
              • 17301
              • 932 Posts
              If I'm understanding you correctly it sounds to me as though you want a custom manager page which manages jobs. This CMP will be a stand alone page for your site editor to add, edit and remove job listings. You can then call the jobs into a template where you want them to be displayed. Please check this video for getting started:
              https://www.youtube.com/watch?v=jwzx6O7zdaU


              Other properties, outside of the database of jobs, can be controlled on individual resources with the template variables as normal. If you need 'global' settings and a nice interface then consider looking at the clientconfig extra which presents a nice screen for users to manage global site variables.

              Preview:
              https://assets.modmore.com/img/sliders/clientconfig.jpg

                ■ email: [email protected] | ■ website: https://alienbuild.uk

                The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                • 3749
                • 24,544 Posts
                @bobray I have been thinking about this as well, using the system settings but I cannot oversee yet how to present the maintainer just a section of the system settings and also nice interface to add, edit, delete new jobs descriptions.


                As LK said, there's an extra called ClientConfig for messing with System Settings.

                That said, I no longer think you should put job details in System Settings.

                A Custom Manager Page is one way to go. Building on that, you could just use a resource for each job with the job specifics in TVs, chunks, or co-opted resource fields (description, introtext, longtitle, etc.). The CMP could create the resources.

                As you suggested, you can also put some of the information in chunks. If you name the chunks after some unique characteristic of the job, prefixed with the two-letter language code, you could pull the appropriate ones in without resorting to multiple contexts (unless you need multiple contexts for some other reason). I tend to avoid multiple contexts when possible because they complicate things.

                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 17301
                  • 932 Posts
                  Also as a side note you mentioned you're using 2.5.6 version of MODX. You'll want/need to upgrade straight away due to critical security breaches.
                    ■ email: [email protected] | ■ website: https://alienbuild.uk

                    The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                    • 54629
                    • 3 Posts
                    Hi,

                    @LK This was a typo, I am using 2.6.5, it's the first Modx I am working with. I have heard about the issues and hacked sites in previous site. I switched X-Powered-By header off in Modx. No has to know a site running Modx maybe it helps someway.

                    That video you shared about the CMP, Migx and PDOTools is great! I am considering this as a solution to the problem of how to implement a job listing on the site. I will have to watch it a few times again. A new world opens up. Implement your own DB tables, create corresponding forms and how to use in the code.

                    @BobRay I have also discovered the properties of Chunks, some sort of global variables but for another element in the tree. New possibilities! In the end I have decided to use Contexts for the implementation of a multilanguage site using the extra XRouting. All page speficic markup is in the chunks, content in a few TV variables which are filled with language specific content for the pages in each context. I use Lexicons for prompts in forms. At least it works for now but from all the threads I have read I know you are not in favor of using context. Maybe, in a few months I have a different opinion. I am still discovering new aspects (and behaviour) of Modx. Indeed, I think CMP is the way to go for the problem of how to deal with site (app) specific data. [ed. note: louisktjek last edited this post 5 years, 6 months ago.]
                      • 46886
                      • 1,154 Posts
                      with multi lingual also be careful to have everything set up as utf-8, the standard one. Not for every combo of languages, but you are gonna get latin/swedish databases if you don't specify your db otherwise, that can cause collation problems down the line depending on your needs