Forum Activity

Forum feed

pnRender doesn't show when assigned too much text  Top

Goto page: 1 - 2 [+1]

  • Okay, so this is really bugging me. I am assigning to the template a variable who's value contains a lot of characters (57595 to be exact). Whenever I do this (or other long strings) nothing shows. If I shorten the string to lets say 25000 characters, it shows fine. Now there are a few things I know.....

    1) It has nothing to do with the string itself. I can change it to 50000 "x"s and it still doesn't work. Likewise, if I just print the string itself (ie echo $str) it prints fine.

    2) It has nothing to do with displaying it. If I remove the line in the template that displays it, it still doesn't work. If I comment out the assign line in the PHP, it works fine though, so I am assuming it has to do with assigning it.

    Is this a problem others have had? Is there a limit to the length of the string to be assigned and is there anyway to fix it (other than splitting the text trying to be displayed into multiple variables to assign)?
  • I would guess you are possibly exceeding your memory limit set your php.ini.

    ***Nothing more than a guess***

    --
    David Pahl
    Zikula Support Team
  • AmmoDump

    I would guess you are possibly exceeding your memory limit set your php.ini.

    ***Nothing more than a guess***

    Unfortunately, that's not it. I tried increasing the memory to a really high amount and it still won't work.

    From what I could gather in the pnRender/Smarty code, all 'assign' does is add the key/value to an array. I am able to add a string with 50000 'x's in an array I created without problems.

    Thanks for trying though. :)
  • http://smarty.php.net/manual/en/language.custom.functions.php#language.function.assign
    Sometimes differ I found myself
    eg
    assign var=text value=$subtitle [no quotes]
    is not the same as
    assign var=text value="This is the subtitle of the title" [quotes]
    It seems trivial, but sometimes it does the trick...
    not to mention in some cases you need the backticks [or how are they called] ``

    - Igor

    --
    Have a nice day
    zikulapro.com is currently running
    Zikula 1.1.1
  • Quote

    http://smarty.php.net/manual/en/language.custom.functions.php#language.function.assign
    Sometimes differ I found myself
    eg
    assign var=text value=$subtitle
    is not the same as
    assign var=text value="This is the subtitle of the title"
    It seems trivial, but sometimes it does the trick...
    not to mention in some cases you need the backticks [or how are they called] ``

    - Igor

    Oops, that's my fault in explaining. I'm assigning it in the PHP script....

    Code

    //store a value obtained in my_sql db into $des
    echo $des;
    $pnRender->assign('des', $des);

    The echo statement works correctly so it has nothing to do with the string or SQL. And whether or not I am actually displaying $des in the template does not matter.
  • askmike1

    I am assigning to the template a variable who's value contains a lot of characters (57595 to be exact). Whenever I do this (or other long strings) nothing shows. If I shorten the string to lets say 25000 characters, it shows fine.


    I also remember some similar problems I had a few months ago.
    Could you please try out 32700 as well as 32800 characters?

    --
    We Guite your project!
    ModuleStudio
  • Okay, now my problem has apparently changed. I now get the error ONLY if I place textarea tags around long text. So ie.....

    Code

    blah blah blah
    LONGTEXT HERE
    blah blah blah

    shows fine, but....

    Code

    blah blah blah
    <textarea>
    LONGTEXT HERE
    </textarea>
    blah blah blah

    doesn't work.



    edited by: askmike1, Oct 15, 2007 - 09:30 AM
  • Have you looked at the page source to see if the text area tags are there? Row and column attributes on the text area?

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • Just a thought, but have you tried displaying this through different browsers? Could it be a browser issue? I know IE sometimes doesn't like big pages in div tags.

    --
    Under Construction!
  • HammerHead

    Have you looked at the page source to see if the text area tags are there? Row and column attributes on the text area?

    The textarea tags are in the template code with row & column attributes (and it only breaks with those textarea tags). I can't look at the source though on the displayed page because.... well... nothing is displayed.

    Topiatic

    Just a thought, but have you tried displaying this through different browsers? Could it be a browser issue? I know IE sometimes doesn't like big pages in div tags.

    Doesn't work with IE or Firefox. :(
  • Any other ideas? This problem only happens when I surround the text with textarea tags (I can display the text fine, I can place it into a hidden input field, I can do basically anything but putting textarea tags around it). Does pnRender, Smarty or Postnuke do something to textarea tags that would cause this problem?
  • I remember having a similar problem about a year ago (.762). I wrote a module that imports data from external databases into Pagesetter publications through a form. I did have the problem in IE and FF, but not in Opera. I eventually found a workaround. Please try Opera and see how that behaves?

    Another thought: do you have 'trim white spaces' or 'shortURL' output filters enabled? If you have try switching them of.
  • Okay, so I am now 100% sure this isn't a Smarty problem (I've tried it with just Smarty and can easily display 100,000's of characters). So now I just have to figure out whether this is a pnRender problem or something another part of postnuke is doing.

    Now to add to the confusion, if I comment out the $GLOBALS['theme_engine']->themefooter(); line in footer.php, it will display fine (just not within in my theme). The code for themefooter() is....

    Code

    function themefooter()
            {

                // end output buffering and get module output
                $maincontent = ob_get_contents();
                ob_end_clean();

                // add the module wrapper
                if (!$this->system && (!isset($this->themeconfig['modulewrapper']) || $this->themeconfig['modulewrapper'])) {
                     $maincontent = '<div id="pn-maincontent" class="pn-module-'.DataUtil::formatForDisplay($this->module).'">'.$maincontent.'</div>';
                }

                // Assign the main content area to the template engine
                $this->assign('maincontent', $maincontent);


                // render the page using the correct template
                $this->display($this->themeconfig['page'], $this->pageid);

            }

    (and yes, if I erase

    Code

    <!--[$maincontent]-->
    from my theme template, the page will display, of course with no actual module content)



    And no, trimwhitespaces & shorturls being disabled doesn't do anything (and it doesn't work with Opera, FF, IE or Safari). :(


    And finally, to add to the confusion even more, if in my main theme template I change

    Code

    <!--[$maincontent]-->
    to

    Code

    <!--[$maincontent|escape]-->
    , it will actually display everything (even when I have the textarea tags)..... of course, it will display the HTML code itself, not what the code is supposed to make.



    edited by: askmike1, Oct 19, 2007 - 11:22 PM
  • To simplify things a bit, here is a bit of code I saved as test.php....

    Code

    <?php

    include('includes/pnAPI.php');

    pnInit(PN_CORE_ALL & ~PN_CORE_AJAX);

    Loader::includeOnce('header.php');

    $pnRender = new pnRender("Movies");
    $x = '';
    for($i=0; $i<50000; $i++) $x .= 'x'; //create 50000 x's
    $pnRender->assign('name', $x);
    $pnRender->display('test.tpl');

    //Loader::includeOnce('footer.php');
    ?>


    test.tpl contains...

    Code

    <textarea>
    <!--[$name]-->
    </textarea>


    Now as is, that code works fine and it displays the textbox with all the text (just not in my theme template).

    If I uncomment the Loader::includeOnce('footer.php'); line, it displays nothing.

    If I uncomment that line AND delete the textarea tags, it will display the entire text within my template.
  • Have you got a visual editor or JS quicktags enabled?

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide

Goto page: 1 - 2 [+1]

This list is based on the users active over the last 60 minutes.