ok, so I've changed it from WP shortcode, to HTML comment style.

I also changed from mediaspace to flarevideo (seems easier to work
with)

Here is what I have so far, and the issue I'm running into

I have the following in my page:
<!-- flarevideo width=200 height=400 src=Simon_Sinek_why.flv
showcaption=true thumb=Simon_Sinek_why.png -->

This is the initial pattern matched:
$pattern = '/\<\!--\s*flarevideo\s(.+?)\s*--\>/i';

Then I loop through each match (so a page can have more then 1 video),
and apply this match:
preg_match_all('/(\w+)\s*=\s*(\S+)/i', $tag, $param_matches);

Then I run this code:
foreach($param_matches as $param_match) {
           $params[$param_match[1]] = $param_match[2];
}

When I print_r $params, I get the following:
Array
(
    [autoplay] =>
    [controls] =>
    [autobuffer] => 1
    [poster] =>
    [width] => 500
    [height] => src
    [showcaption] =>
    [closetitle] =>
    [firstitem] => 1
    [caption] => My Media
    [flashSrc] => media/FlareVideo.swf
    [height=400] => src=Simon_Sinek_why.flv
    [400] => Simon_Sinek_why.flv
)

The blank values are either false or null, due to the default values I
put in.

Now, as you can see, height = src, "height=400" =
'src=Simon_Sinek_why.flv' and 400=Simon_Sinek_why.flv

When I blank out the default values, and create the params array
strictly off of what is grabbed from the matches, I get:

Array
(
    [height=400] => src=Simon_Sinek_why.flv
    [height] => src
    [400] => Simon_Sinek_why.flv
)

Something is not right with the regex.

Any help you can offer would be great.



On Jan 24, 1:55 pm, Chris Meller <[email protected]> wrote:
> On Jan 24, 2011, at 8:53 AM, Owen Winkler wrote:
>
> > This is certainly a valid approach, but a regex would let you do things 
> > that an explode would not.
>
> While we're suggesting alternate approaches, I would suggest using an HTML 
> comment (ala our <!-- more --> tag for breaking apart the summary) instead of 
> the WP shorttag format. In the future if you should migrate to another 
> platform or stop using the plugin the comment should be hidden, rather than 
> showing the shorttag to people visiting the page.
>
> Just a suggestion, dealing with WP's [caption] shorttags was annoying when I 
> switched.

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev

Reply via email to