string parsing in between curly bracket |
[eluser]Reynolds[/eluser]
[quote author="umefarooq" date="1294235849"]nice thread im also looking for code or library which can work like wordpress short codes which can help users to and tags from backend and in front end it become html or your desired output. here is one library which can help you more https://bitbucket.org/dhorrigan/simpletags/src[/quote] Thanks a million umefarooq! :-)
[eluser]Phil Sturgeon[/eluser]
[quote author="umefarooq" date="1294235849"]nice thread im also looking for code or library which can work like wordpress short codes which can help users to and tags from backend and in front end it become html or your desired output. here is one library which can help you more https://bitbucket.org/dhorrigan/simpletags/src[/quote] You beat me to it. +1 for this, been using it a while and its an excellent tag parser.
[eluser]umefarooq[/eluser]
yes its a nice library but here is my question how we can use this library work like wordpress shortcodes, which can be really handy for user or designer for any themes check out this theme using shortcodes http://prosto.cult-f.net/skins/shortcodes/ this tutorial how to use shortcode in wordpress http://net.tutsplus.com/tutorials/wordpr...right-way/
[eluser]diZzyCoDeR[/eluser]
It's been a month, but maybe this will help others... It *IS* indeed a great library, and it *DOES* come with a function to do what you're asking. I missed it completely until I was rifling through it to steal code to write myself a function that would simply convert the data stored in a variable Code: $content = '{foo} and {bar}'; Code: $foobar['foo'] = 'FOO'; ...then I saw it, parse_globals() -- which you could use on it's own, or part of the Simpletags library, as such: Code: $this->load->library('simpletags'); thus, $output will evaluate to: Quote:FOO and BAR Code: /**
[eluser]diZzyCoDeR[/eluser]
Furthermore, I'm using both the methods and it took me a bit to figure out how, so here's the gist: Code: // parse the db field using simpletags and my little callback function: Code: /** << slap this in MY_date_helper.php >> and some output fo yo ass... [quote] Array ( [content] => On Feb 16, 2011 {name} did some stuff at {place} and thought it was {rating}. [tags] => Array ( [0] => Array ( [full_tag] => {date:display format="%M %d, %Y"}1297916387{/date:display} [attributes] => Array ( [format] => %M %d, %Y ) [full_segments] => :display [segments] => Array ( [0] => [1] => display ) [content] => 1297916387 [marker] => marker_0k0dj3j4nJHDj22j ) ) ) [quote]
[eluser]Reynolds[/eluser]
Nice! Keep it coming :-) Good thing I keep track of this thread. |
Welcome Guest, Not a member yet? Register Sign In |