Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Goto page: 1 - 2 [+1]

Bottom
pnRender doesn't show when assigned too much text
  • Posted: 13.10.2007, 07:52
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14
    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)?
  • Posted: 13.10.2007, 08:53
     
    AmmoDump
    rank:
    Professional Professional
    registered:
     December 2003
    Status:
    offline
    last visit:
    21.11.08
    Posts:
    2975
    I would guess you are possibly exceeding your memory limit set your php.ini.

    ***Nothing more than a guess***

    --
    David Pahl
    Zikula Support Team
  • Posted: 13.10.2007, 09:12
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14

    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. :)
  • Posted: 13.10.2007, 15:27
     
    videokid
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    901
    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.be is currently running
    Zikula 1.0.2
  • Posted: 13.10.2007, 18:56
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14

    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.
  • Posted: 14.10.2007, 14:24
     
    rank:
    Helper Helper
    registered:
     January 2003
    Status:
    online
    Posts:
    216

    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
  • Posted: 15.10.2007, 06:10
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14
    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
  • Posted: 15.10.2007, 14:06
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    09.11.08
    Posts:
    13413
    Have you looked at the page source to see if the text area tags are there? Row and column attributes on the text area?

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 15.10.2007, 15:18
     
    Topiatic
    rank:
    Professional Professional
    registered:
     November 2003
    Status:
    offline
    last visit:
    06.11.08
    Posts:
    1675
    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!
  • Posted: 15.10.2007, 19:34
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14

    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. :(
  • Posted: 18.10.2007, 04:00
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14
    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?
  • Posted: 18.10.2007, 12:46
     
    dits
    rank:
    Helper Helper
    registered:
     February 2005
    Status:
    offline
    last visit:
    14.11.08
    Posts:
    284
    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.
  • Posted: 20.10.2007, 09:05
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14
    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
  • Posted: 20.10.2007, 09:16
     
    askmike1
    rank:
    Freshman Freshman
    registered:
     January 2006
    Status:
    offline
    last visit:
    22.01.08
    Posts:
    14
    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.
  • Posted: 20.10.2007, 17:39
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    09.11.08
    Posts:
    13413
    Have you got a visual editor or JS quicktags enabled?

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide

Goto page: 1 - 2 [+1]

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula