We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22629
    • 194 Posts
    I’m using Revolution to develop a new site which is being built in its own context, however the template variables aren’t parsing.

    e.g.
    create a template with a TV tag (e.g. [[*stylesheet]])
    create a document (in web context) assigned to this template and set the stylesheet to default.css
    view the document - stylesheet TV tag gets parsed correctly and outputs default.css
    move the document into its own context and access it via a hostname that switches the context to that of the document
    view the document - stylesheet TV tag is empty

    Is it something I’m missing or this a bug that needs filing in JIRA?

    Thanks.
      Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

      modx Revolution 2.2.6
      Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

      Content-Managed Websites Built on MODX
    • Contexts should have no affect on TV parsing. Sounds more like there is another problem. Is the HTTP response header correct on the page you are viewing this on? All of my TV’s that are on pages in multiple contexts are working like a charm...
        • 22629
        • 194 Posts
        There’s definitely some issue here - I’ve set up a TV in a template and set its value in a page that’s in the "web" context. It parses correctly and the page and TV outputs fine.

        As soon as I move the page into a different context, clear the cache, and re-visit the page (using the correct HTTP host site) the page outputs fine, but the TV is missing (i.e. where the TV should be it’s just blank.)

        Returned HTML in web context:

        <html>
        <head>
        <title>MNET Live - Enterprise DNS hosting | ASEU Network CMS</title>
        <link rel="stylesheet" type="text/css" href="/content/mnetLive/css/common.css" />
        <link rel="stylesheet" type="text/css" href="/content/mnetLive/main.css" />
        </head>
        <body>
        ... rest of content ...
        </body>
        </html>

        Returned HTML in "mnetLive" context:

        <html>
        <head>
        <title>MNET Live - Enterprise DNS hosting | MNET Live</title>
        <link rel="stylesheet" type="text/css" href="/content/mnetLive/css/common.css" />
        <link rel="stylesheet" type="text/css" href="/" />
        </head>
        <body>
        ... rest of content ...
        </body>
        </html>

        Notice the context has changed because the second half of the page title is different, but in the second context the second stylesheet has no value except "/" - the actual code for this in MODx is (obviously "LiveStylesheet" is my TV) :

        <link rel="stylesheet" type="text/css" href="/[[*LiveStylesheet]]" />

        There’s very little content on this site so if you want I can set you up a login. I cannot see anything I’m doing wrong.
          Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

          modx Revolution 2.2.6
          Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

          Content-Managed Websites Built on MODX
        • Is the value still set when you edit the document after you move it? And have you refreshed the cache manually since moving it?
            • 22629
            • 194 Posts
            Yep to both - the value is still there when you edit the document after it’s been moved, and I have refreshed the cache.

            Even if I don’t refresh the cache, after moving the document between contexts, the value disappears or appears, but yes, I have tried refreshing the cache manually too.
              Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

              modx Revolution 2.2.6
              Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

              Content-Managed Websites Built on MODX
              • 22629
              • 194 Posts
              To all the MODx developers who know the structure of the new "core" and Revolution :-

              Where should I begin looking (in the PHP code) to try and debug this issue? I was going to raise a bug in Jira, but afraid of it being closed as it seems to be working in opengeek’s case.

              I’d like to lend a hand in tracking this down as it is hindering a project I’m working on, but I’m very lost when it comes to the layout of Revolution!

              As a side question, do you know when you expect to release alpha-6? I cannot install TinyMCE as apparently the packages on the wtf have been re-designed to work with alpha-6 onwards, and I don’t know enough about Revolution (yet!) to install it manually.

              Thanks,
              Andy
                Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

                modx Revolution 2.2.6
                Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

                Content-Managed Websites Built on MODX
                • 28215
                • 4,149 Posts
                Quote from: Pandy06269 at Nov 12, 2008, 07:59 PM

                To all the MODx developers who know the structure of the new "core" and Revolution :-

                Where should I begin looking (in the PHP code) to try and debug this issue?  I was going to raise a bug in Jira, but afraid of it being closed as it seems to be working in opengeek’s case.

                I’d like to lend a hand in tracking this down as it is hindering a project I’m working on, but I’m very lost when it comes to the layout of Revolution!

                As a side question, do you know when you expect to release alpha-6?  I cannot install TinyMCE as apparently the packages on the wtf have been re-designed to work with alpha-6 onwards, and I don’t know enough about Revolution (yet!) to install it manually.

                Thanks,
                Andy

                Andy,

                Jason and I talked about your issue today, and we just patched the SVN version with a fix for it. It *should* (in theory) work now. If you could try it out, that’d be great.

                To give you an idea of what we fixed, if you go to core/model/modx/modtemplatevar.class.php (the class for the modTemplateVar object), and look at the functions ’renderOutput’ and ’renderInput’, you’ll notice that there was something like this:

                $outputRenderPath = MODX_PROCESSORS_PATH.'element/tv/renders/'.$this->xpdo->context->get('key').'/output/';
                


                That would find the render template for the TV, based upon the context. However, what it wasn’t doing is that if you wanted a TV in a context that’s not web/mgr, and that didn’t have custom renderers already packaged in, then it wouldn’t load the right file.

                So, we patched it with this:

                $outputRenderPath = MODX_PROCESSORS_PATH.'element/tv/renders/'.$this->xpdo->context->get('key').'/output/';
                if (!file_exists($outputRenderPath) || !is_dir($outputRenderPath)) {
                      $outputRenderPath = MODX_PROCESSORS_PATH.'element/tv/renders/web/output/';
                }
                


                Now it will default to the web context should no overrides be found, which should fix your issue. Thanks!


                P.S. We are shooting for a release of alpha-6 in the next week or so. We’re trying to nail down an issue with packaging and the uninstallation of packages that contain pre-existing objects. As soon as we finish that, we should be near 100% ready for alpha-6, and then the next step onward should be beta-1.
                  shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                  • 22629
                  • 194 Posts
                  Wicked, that worked a treat, thanks! I’ve done the following tests to verify this has fixed the issue:

                  - page in mnetLive context with TV value set - OK
                  - move page to web context, change TV value - OK - outputs new TV value
                  - move page to mnetLive context, change TV value again - OK - outputs new TV value

                  Another quick question - I’m now running SVN revision 4413 on my server - does it need the _build directory or can this be safely deleted?

                  Thanks again!

                  Andy
                    Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

                    modx Revolution 2.2.6
                    Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

                    Content-Managed Websites Built on MODX