1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Combine Two Lines of Code ....

Discussion in 'General PHP and MySQL Discussions' started by LPH, May 25, 2013.

  1. LPH

    LPH Well-Known Member


    I have two lines of code which are leading to a posting behavior that is not as I desire.

        $body '';
    $post_contains == 'full')
    $body $XF->visitor->get('username') . ' submitted a new blog post';
    $body .= '[quote]' XenForo_Helper_String::autoLinkBbCode(XenForo_Html_Renderer_BbCode::renderFromHtml(nl2br($content))) . "[/quote]";
    /* Add preg_replace */
    $body preg_replace('#\[nlposts .*\]#'''$body);
    /* Add Trim to 500 Words */
    $body XenForo_Helper_String::wholeWordTrim($body500);
    $body .= "[URL='" get_permalink($post->ID) . "']Continue reading the Original Blog Post[/URL]";
    The problem is that the Continue reading the Original Blog ends up inside the quote tags.

    I keep looking at this code and trying to figure out how to make sure that the link is outside the quote. The resource manager uses a template to achieve the above but I'm not sure how to add templates and get them called properly here.

    Does anyone have any suggestions? If you think a template is the best way to accomplish this then is there a write up I've missed which might help?
  2. xf_phantom

    xf_phantom Well-Known Member

    you don't want to start the quote and then trim it;)
    trim the content, put it inside of the quote tags and then add the "continue reading" link
  3. LPH

    LPH Well-Known Member

    I understand but I believe this is why the two lines need to be combined:

    $body .= '' XenForo_Helper_String::autoLinkBbCode(XenForo_Html_Renderer_BbCode::renderFromHtml(nl2br($content))) . '';

    $body XenForo_Helper_String::wholeWordTrim($body500);
    This is because if I simply add the line between the Continue .... :

    $body '[quote]' $body '[/quote]' ;
    Then the username and title end up inside the quotes :(

    So, how do I combine two XenForo_Helper_String statements?

    I hope that makes sense what I'm asking.
  4. LPH

    LPH Well-Known Member

    YES !

    I got it to work. This is how I combined them

    .= '[quote]' XenForo_Helper_String::wholeWordTrim(XenForo_Helper_String::autoLinkBbCode(XenForo_Html_Renderer_BbCode::renderFromHtml(nl2br($content))), 500) . '[/quote]';
    It seems to be working. As always - thank you for your help!

    Let me know if you think there is a better way.

Share This Page