Jump to content

Generic Media Field


bipster
 Share

Recommended Posts

Hi,

I've discovered PW recently and I'm starting to get the hang of it. I'm used to build artist portfolios with the Indexhibit2 CMS and I was wondering if it would be possible to replicate one of its features in PW.

In Indexhibit2 you can upload many media types (images, local and external videos, sounds, etc...) to a page and then reorder them if you want. I know that PW has a multiple image field. My question is, would it be possible to modify it to allow adding other media type items to it? Is there an exisiting module out there for this?

Thanks in advance

Link to comment
Share on other sites

Welcome to the forum bipster!

For the projects in our website (see my signature) I used a table field and works very well

post-88-0-26826800-1406997613_thumb.png

I created three templates: paragraph, images and video, and added them to the table field "content"

These are the fields in each template:

paragraph: text (textarea)

images: is_slider (checkbox), images (image)

video: mp4 (file), webm (file), poster (image) 

on each template I put the code for rendering each object, for example, the video template is like this:

//video.php (simplified)

<div class="video">
    <video muted poster="<?=$page->poster->url?>">
      <source src="<?=$page->webm->url?>" type="video/webm">
      <source src="<?=$page->mp4->url?>" type="video/mp4">
      <p>bad browser, no video for you!</p>
    </video>
</div>

and on the project pages I output all the content simply with:

foreach($page->content as $c) {
    echo $c->render();
}
  • Like 4
Link to comment
Share on other sites

I've tried the new PageTable field from 2.5dev and it's great. The only thing I don't like is the fact that you have to title every new page, which is a bit cumbersome. I guess my ideal field would be a cross between the visual design of the Repeater and the functionality of the PageTable.

Link to comment
Share on other sites

You can show the title field as collapsed in those templates, or even hidden. I collapsed them on mine because as you can see in the screenshot they are good to identify each block. It also happened that I edited some blocks directly by searching in the admin for their titles. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...