Helping you Build Your Own Social Network!

Faster, better and easier!

Need a bit of help changing a function

(6 posts) (2 voices)

Tags:

No tags yet.


  1. @Brajesh
    I figured this was a great place to ask this question as you are already very familiar with this function from our prior work on getting the video to show up in the activity stream.

    In a nutshell, the function looks for a custom-field 'embed' from a post which is being displayed, it then parses the video code and changes out the height and width to a fixed value set via calling the function like:

    <?php $video = video_embed('width=200&height=150'); ?>
                                    <?php
                                    if (!empty($video)){ ?>
                                    <div class="video <?php echo $GLOBALS['single_align']; ?>">
                                        <?php echo $video; ?>
                                    </div>
                            <?php } ?>

    What I am trying to do:
    basically instead of having the video as a custom field in a post, I want to define the video source itself in the function.

    example:
    $data['setting-custom_video']
    That variable stores the actual embed code for the video itself.

    what I want is to be able to call the function like:
    <?php $video = shawn_embed('video=$data['setting-custom_video']width=200&height=150'); ?>

    Long story short, is that I am trying to recycle this function into one that I can use in my theme admin panel. I am already having the user save the embed code which is stored under the 'setting-custom_video'.

    If you are able to find the time, could you look at helping me modify the video_embed function to work like I have described above?

    source of video_embed:
    http://pastebin.com/fJADFbMM

    side note:
    What is wrong with this code? (still trying to figure out basic code syntax but learning fast)

    if(is_file(TEMPLATEPATH . '/includes/cslider/'.$data['mydatastring'].'.php')){
        require_once(TEMPLATEPATH . '/includes/cslider/'.$data['mydatastring'].'.php');
    }

    thanks for any help provided. I can say once the last few pieces are finished, this is going to turn into one killer plugin for everyone.

    Posted 1 year ago #
  2. HI Shawn,
    If you don't mind, I will post back when I get back to work again today.

    Posted 1 year ago #
  3. no worries.
    I'm just glad to have a place I can come and ask questions like this.

    Posted 1 year ago #
  4. Hi Shawn,
    Thanks for the patience and understanding.
    I just edited the code.
    you can have a look here
    http://pastebin.com/GubaYN3W

    Please note, I assume you are trying to pass the video embed code using the "video" key in the arguments.

    Also, the best way to call be

    <?php $video = shawn_embed('video='.$data['setting-custom_video'].'&width=200&height=150'); ?>

    I just edited to make it sure that single quotes do not conflict and the $data['settings-custom_video'] gets parsed.

    regarding the code

    if(is_file(TEMPLATEPATH . '/includes/cslider/'.$data['mydatastring'].'.php')){
        require_once(TEMPLATEPATH . '/includes/cslider/'.$data['mydatastring'].'.php');
    }

    If you are using it in child theme and the /includes/cslider/'.$data['mydatastring'].'.php' is in your child theme, It will not work,
    try to replace TEMPLATEPATH with STYLESHEETPATH

    That should make it work.

    Please do let me know if you find issues(I guess, the video embed will have still some issues.)

    Posted 1 year ago #
  5. @Brajesh
    I wanted to take a moment to say thank you for the code edits. It is indeed pulling in the video, but for some reason the output is not working correctly. Either the player does not show up due to the plugin messing with the code as when I try to use videos from youtube, or with other videos the player simply does not load.

    I will go through and figure out why this is happening tonight. I've tried to fix it for some time now without success, but will give it another attempt.

    Thanks again

    Posted 1 year ago #
  6. @Brajesh

    Well you were correct, there are some real problems with the script. When I embed a video from youtube, it seems to cut off 90% of the source. Other video's don't load, while some do....

    I've spent a week on this, and still have no solution.

    Can you think of a more elegant way to simply pass a $video parameter containing embed code, and have it resized to specific specifications?

    I think what I am trying to do is really obvious, and I'm guessing there is a much better way of doing this but everything I have tried is simply not working. Could use a code guru on this one if you have the time.

    Posted 1 year ago #

Reply

You must log in to post.