We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16278
    • 928 Posts
    Thanks for the feedback - how I hate those escaped character tangles! I suppose I’ll have to descend once again into the horrors of "what bit of what is doing that and when" with the apostrophes.

    I did something about quotation marks the other day, after it occurred to me to test for them in the text fields, but I don’t set PHP to do anything with apostrophes (and it would be using entities if I did), so I think it will have to be down to $modx->db->escape somewhere. Do share if you find the culprit.

    With tags, the only problems I’ve hit have been with preserving the settings. The optionsbuilder class should be dealing with HTML generation and retrieval of stored values regardless of number, it just does a loop through the options that are defined. Can you post the exact definition of your tags?

    smiley KP
      • 26016
      • 561 Posts
      Greets KP,
      Thanks for your note. I’ll be working on this today, so I will definitely share if I find the "escape" spots.

      In the meantime, here’s how I set up the tags:
      Time Management||Project Management||Meetings||Mergers||Case Study


      My first thought (probably wrong) was maybe something about using blanks. I changed the last one to just "Case", and that didn’t seem to help. Then again, maybe I needed to delete and re-add the blog post having the Case Study tag? Or maybe I need pipes after "Case Study"? I think the rest of my TV is ok... checkbox as input, Delimited List widget, delimiter being a comma.

      Thanks mucho,
      Dave

      Quote from: kp52 at Sep 21, 2009, 04:14 AM

      Thanks for the feedback - how I hate those escaped character tangles! I suppose I’ll have to descend once again into the horrors of "what bit of what is doing that and when" with the apostrophes.

      I did something about quotation marks the other day, after it occurred to me to test for them in the text fields, but I don’t set PHP to do anything with apostrophes (and it would be using entities if I did), so I think it will have to be down to $modx->db->escape somewhere. Do share if you find the culprit.

      With tags, the only problems I’ve hit have been with preserving the settings. The optionsbuilder class should be dealing with HTML generation and retrieval of stored values regardless of number, it just does a loop through the options that are defined. Can you post the exact definition of your tags?

      smiley KP
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
        • 3866 ☆ A M B ☆
        • 350 Posts
        Hi,

        Is it possible to at a picture TV and a url TV at PubKit edit page?
        If so, how can I do this? How can I make it visible on my main blog page.
        I’m making a newsblog where a picture and a _blank URL must appear. So visitors can go for more info to the related website. The detail page is only used for giving comments.

        Thx in advance.
        Benny
          Helen Warner
          Number one pixel!
          Proud to be linked with MODX at Crimson Pixel
          • 16278
          • 928 Posts
          I’m working on an events calendar using mostly the same code as pkBlog, and initially I included a URL field to add links to more information, downloadable posters etc. But then it occurred to me that what I wanted was already there, in the shape of buttons in the TinyMCE toolbar. Does TinyMCE provide what you need already?

          If not, it would be a case of modifying some lines of code in the main include file so that your TVs are stored and retrieved in the right places. Untested thoughts:
          // LINES 67-71: populate template variables as array 
          // name the fields that may need to be extracted from $doc object
          $tvs = array('pkDate'=>"",'pkDateTo'=>"",'myURLtv'=>"",'myIMGtv'=>'');
          $tvs[$tagTv] = $tags;
          $tvs['pkPreviewFlag'] = (isset($fields['preview'])) ? 1:0;
          

          Somewhere in the segment handling form postback values, you need to transfer the relevant $fields[] data to the $tvs array elements.

          When you come into the page to re-edit, the TVs should be picked up in the existing loop, and transferred to the $fields array with keys equal to their own names (lines 261-265)
          // retrieve TV values. $fields array will be made into placeholders further on.
          	foreach($tvs as $tvName=>$tvValue) {
          			$tv = $doc->Get('tv' . $tvName);
                      $fields[$tvName] = $tv;
          		}
          
          then placeholders with these names will be created in lines 357-360:
          	foreach($fields as $n=>$v) {
                  $v = htmlspecialchars($v);
          		$modx->setPlaceholder($n, $v);
          	}
          


          Food for thought, at least.
          8) KP

            • 26016
            • 561 Posts
            KP,
            I can see a possible need for an additional data entry field on the blog entry for this. I would like to add a field that would populate a TV. Before I start hacking the pkBlog files, I was just wondering if it’s set up to easily accept "custom" fields like this, or will I have to hack the core to have this happen?

            Thx! Dave
              MODx and Wordpress development
              Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
              • 16278
              • 928 Posts
              There is no &customFields parameter yet! So for now it is a case of adding the name of the TV to the list of array elements as in the previous post:
              $tvs = array('pkDate'=>"",'pkDateTo'=>"",'myURLtv'=>"",'myIMGtv'=>'');
              That’s enough to set it up for creation along with a new document and retrieval for re-editing, as long as it’s a text field or other type that is stored in the same format as it is entered. If it’s a date or some other type of field that you apply widgetry to, you may need to add conversion functions in the re-editing code starting at line 251.

              I’ve given some thought to a "custom fields" parameter, along with considering how best to combine other "standard" flavours of PubKit such as events and sidebar posts into one parameter-driven snippet. I can see several ways of doing it, the problem is deciding which way is best with a view to compatibility with future expansions.

              smiley KP
                • 26016
                • 561 Posts
                KP,
                Great answer, I appreciate it. I will be keeping an eye on this and your other developments. Anything that makes blogging on MODx more feasible is great. Generally for blogs, I stick to Wordpress exclusively, but there are situations where MODx provides other functionality that is needed, and also some of my clients are unwilling to use WP. So keep up the excellent work!

                Normally I’m very self-sufficient, but when it comes to any Ditto complexity, I often end up begging for help here. It’s a black art. I’ve just done my first serious Ditto config hacking, and that can offer some nice stuff.

                Thx again, Dave

                Quote from: kp52 at Sep 28, 2009, 10:26 AM

                There is no &customFields parameter yet! So for now it is a case of adding the name of the TV to the list of array elements as in the previous post:
                $tvs = array('pkDate'=>"",'pkDateTo'=>"",'myURLtv'=>"",'myIMGtv'=>'');
                That’s enough to set it up for creation along with a new document and retrieval for re-editing, as long as it’s a text field or other type that is stored in the same format as it is entered. If it’s a date or some other type of field that you apply widgetry to, you may need to add conversion functions in the re-editing code starting at line 251.

                I’ve given some thought to a "custom fields" parameter, along with considering how best to combine other "standard" flavours of PubKit such as events and sidebar posts into one parameter-driven snippet. I can see several ways of doing it, the problem is deciding which way is best with a view to compatibility with future expansions.

                smiley KP
                  MODx and Wordpress development
                  Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
                  • 3866 ☆ A M B ☆
                  • 350 Posts
                  Hello kp52 & Samba

                  Would like to thank you bolt cause it helpt me a lot on this matter wink

                  Now I have another few terribel problems, but first I give you some more info regarding the server / system e.s.

                  Testserver on my pc with windows XP pro with latest XAMPP configuration.
                  Remote server: Apache / Linux with php 5.2.8
                  phpInfo() on http://www.dehuizenmarkt.be/phpinfo (if needed)

                  -------------------------------------------------------------------------------------

                  General info Modx:
                  Server
                  MODx versie 1.0.0
                  Versie codenaam rev 5601
                  phpInfo() Bekijken
                  Toegangsrechten Ingeschakeld
                  Server tijd 12:27:02
                  Lokale tijd 12:27:02
                  Server verschil 0 h
                  Database naam ftp10438_database
                  Database server localhost
                  Database Versie: 5.0.67
                  Database Karakterset latin1
                  Database Collatie Karakterset latin1_swedish_ci
                  Tabel voorvoegsel (prefix)
                  MODX_BASE_PATH /home/ftp10438/domains/dehuizenmarkt.be/public_html/
                  MODX_BASE_URL /
                  MODX_MANAGER_URL http://www.dehuizenmarkt.be/manager/
                  MODX_MANAGER_PATH /home/ftp10438/domains/dehuizenmarkt.be/public_html/manager/
                  MODX_SITE_URL http://www.dehuizenmarkt.be/

                  -------------------------------------------------------------------------------------

                  Problem 1:

                  Parsing problem in the PostTags snippet. error
                  at line 22: $output .= strftime($dateFormat,$postDate);

                  Error when I use &postDate=`[*pkDate*]` when calling the snippet. If I remove it and use only &dateFormat=`%d %b %Y` it works but he shows 2 dates instead of 1.


                  general error:
                  « MODx Parse Error »
                  MODx encountered the following error while attempting to parse the requested resource:
                  « PHP Parse Error »

                  PHP error debug
                  Error: strftime() expects parameter 2 to be long, string given
                  Error type/ Nr.: Warning - 2
                  File: /home/ftp10438/domains/dehuizenmarkt.be/public_html/manager/includes/document.parser.class.inc.php(770) : eval()’d code
                  Line: 22

                  Parser timing
                  MySQL: 0.0104 s (15 Requests)
                  PHP: 0.0722 s
                  Total: 0.0826 s

                  -------------------------------------------------------------------------------------

                  Problem 2:

                  My preview doesn’t work. There is notting to see, no buttons...
                  He doesn’t execute the file blog.config.php in the ditto/configs/ map.
                  I didn’t change anything in the code, so the file must be correct. So the problem is in the manager. He doesn’t output anything when I click the preview button on my edit/ad page.

                  Do I mis something here? I made a chunck named blog.preview.tpl as explained in the pdf installation file. I repeated every step over and over to find the problem and I’m getting verry tired :’(

                  Any idea what I could forget here?

                  Thx again !
                  Benny
                    Helen Warner
                    Number one pixel!
                    Proud to be linked with MODX at Crimson Pixel
                    • 3866 ☆ A M B ☆
                    • 350 Posts
                    Hello,

                    Problem 2 in previous post is solved.

                    There something wrong with my template, the header was on top of the preview tpl
                    (style position:relative - clear:both was missing)

                    Problem 1 stays. You can see at http://www.dehuizenmarkt.be/immo/blog.html
                    what I meen. If I use the postDate=`[*pkDate*] then an error rise like explaned in previous post.

                    Greets
                    Benny
                      Helen Warner
                      Number one pixel!
                      Proud to be linked with MODX at Crimson Pixel
                      • 16278
                      • 928 Posts
                      I think you are putting PostTags in the wrong template - it is intended to be in the template you use for the full text of individual posts, not the page with the listing generated by Ditto. I tried adding PostTags to a Ditto listing page, and got the same error as you.

                      The listing page uses the [+tagLinks+] placeholder generated by Ditto to link to items with the same tag, and uses PHx to format the date, with [+pkDate:date=`%d %b %y`+]. These are not available when Ditto is not generating the output, which is why PostTags is needed to display the links and date at the top of the full post.
                      smiley KP