Page 1 of 1

PHP? In CMSMS?

Posted: Mon Nov 19, 2007 10:13 pm
by Audoin
Hello!

I have a site, on which I have several videos . Now, I would like to have a combo box where the user can select which video he\she wishes.

What would you suggest to be the best method to implement this with CMSMS? I know PHP, Perl, and am actually quite fluent in several other system programming languages. (eg. C, assembly, etc.) I'm willing to do some work, but I don't really have time to delve into the inner workings of CMSMS and write a plugin. (I've looked into this already. Oh, yeah, I should mention that this does not need to configurable through the CMSMS interface.)

Thanks, and forgive my lack of time.  :)

Re: PHP? In CMSMS?

Posted: Mon Nov 19, 2007 10:22 pm
by Nullig
Have you looked at the FLVPlayer module?

Nullig

Re: PHP? In CMSMS?

Posted: Mon Nov 19, 2007 10:26 pm
by calguy1000
well, it's going to depend on what happens when the user selects a video.... and is there a submit button? 

If you can do it in javascript with a hard coded list..... then that can be coded directly in the page content, or in the template (or even in a global content block).

If you need to read a directory, and stuff to populate the list, then you'll probably want to do a UDT that just spits out the HTML of a form, possibly with some javascript/ajax stuff in there too, and that possibly also handles the results of the POST.

UDT's are (usually small) snippets of php code (without the ) that can be called in your page template or page content with just {udt_name}.

If your code is going to be slightly bigger than a hundred or so lines of code, but only used once, on one page, then you can enable the appropriate option on the config.php and just use {php}echo 'blah blah blah';{/php} directly in the page content block (disable the wysiwyg for this).  You'll see the option when you look at the config.php file, I can't remember the name right now, but it's pretty obvious.

If you want to re-use your code on a different site, then I'd suggest writing a smarty plugin and placing it in the plugins directory.

If it has databases, and you may want an admin interface now, or at some future date, (you said it didn't).... then you'll need a module.

Re: PHP? In CMSMS?

Posted: Tue Nov 20, 2007 3:13 am
by Audoin
Thanks greatly for help! I ended up using a combination of Javascript and PHP.

One more question, however: When I use {php} and then save the file, the contents in {php} are skewed. (ie. "'s changed, "->' changed, etc.) How can I fix this?

Thanks!

Re: PHP? In CMSMS?

Posted: Tue Nov 20, 2007 6:37 am
by cyberman
As Calguy said use a user defined tag !

If you insert content inside {php}{/php} with TinyMCE or other WYSIWYG editor it try to transform it for a "good" output, not for executing :).

Or you switch off WYSIWYG if you edit pages with {php} inside ...