Fork me on GitHub

Creating Plugin for simple regex  Bottom

  • I am creating a plugin that will take something like:

    [-username-Start]

    and replace it with:



    and [-username-End]

    and replace it with:



    Is there nothing already like this in place? I really don't wanna re-create the wheel. This is an attempt to give certain users their own CSS style for writing stories. Anyone got a direction to point me? Or do I just keep on making this from scratch? Thanks in advance...

    --


    With the advent of modern technology, sites like Twitter, and the Facebook Virus...
    I think we should all breathe a collective sigh of relief that I got here in time...
    - randomblink
  • Maybe a modification of the bbcode module would achieve this?

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • This might help you, together with personalized stylesheets.

    I am not sure if it works, it is just an idea.

    Frank

    --
    "He is not dangerous, he just wants to play...."
  • Thanks...
    Having a hell of a time with the logic behind writing this for some reason... bleh

    --


    With the advent of modern technology, sites like Twitter, and the Facebook Virus...
    I think we should all breathe a collective sigh of relief that I got here in time...
    - randomblink
  • Alright...
    Now I am wondering where I am going wrong...
    Here is the code I am using for my Smarty modifier...

    Code

    function smarty_modifier_nstags( $string )
    {
        // The first thing we need to do is SEARCH through the variable that we are
        // passed and search for NS Tags.

        $search = array (
                        '(\[-)(.+?)(-Start\])',
                        '\[-.+?-End\]'
                        );

        $replace = array (
                        '<p class="\2">',
                        '</p>'
                        );

        $text = preg_replace($search, $replace, $string);
        return $text;
    }


    This returns NOTHING... I don't even get the original $string returned...?!?!
    I am putting this in home.htm
    And I am putting it:

    Code

    <!--[$centerblocks|nstags]-->
    <!--[$maincontent|nstags]-->


    Can someone help me...?

    --


    With the advent of modern technology, sites like Twitter, and the Facebook Virus...
    I think we should all breathe a collective sigh of relief that I got here in time...
    - randomblink
  • This

    Code

    $search = array (
                   "#\[-(.+?)-Start\]#si",
                   "#\[-(.+?)-End\]#si"
                   );

       $replace = array (
                   '<p class="\1">',
                   '</p>'
                   );


    works as you want icon_smile . And its also case insensitive.

    Frank

    --
    "He is not dangerous, he just wants to play...."
  • Who are you...?
    I don't whether I hate you or love you...

    Please point me to the books you use for regular expressions...?
    I want to learn this stuff...

    Thank you so much Landseer... You are the freaking greatest!!!

    --


    With the advent of modern technology, sites like Twitter, and the Facebook Virus...
    I think we should all breathe a collective sigh of relief that I got here in time...
    - randomblink
  • I am just sitting here loading and reloading the pages...
    Thank you SOOOOO much...
    I tried this once before... But the reg-ex kicked my butt...
    So I decided I would study Reg Ex more... Then try again later...
    Nothing... At least I was closer this time...
    Thank you so much man... goodness I love Postnuke (sometimes)...

    --


    With the advent of modern technology, sites like Twitter, and the Facebook Virus...
    I think we should all breathe a collective sigh of relief that I got here in time...
    - randomblink
  • Quote

    Who are you...?
    I don't whether I hate you or love you..


    icon_biggrin

    I do not use books, I know http://www.regexplib.com and http://de3.php.net/manual/en/ref.pcre.php icon_smile and modify the stuff I am finding there.

    And I must admit I learned a lot while working on pn_bbsmile / pn_bbcode / pn_bbclick.

    Glad to see that it works for you now.

    Frank

    --
    "He is not dangerous, he just wants to play...."
  • Thanks

    --


    With the advent of modern technology, sites like Twitter, and the Facebook Virus...
    I think we should all breathe a collective sigh of relief that I got here in time...
    - randomblink
  • 0 users

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