Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Advanced template builder component #921

Open
Desertsnowman opened this Issue · 12 comments

3 participants

@Desertsnowman
Collaborator

I have pushed my first component. Its a prototype, so please be kind.
Am still new to Pods, so things wont be perfect until I learn more about the Pods API. There are comments explaining its use and purpose in the main Advanced-Templates.php file.

It's set to Developer Mode: on for previewing.

@pglewis
Owner

Toys! I'll definitely be looking at this, a nice feature set for sure.

@sc0ttkclark
Owner

How do you call PHP blocks from the HTML tab?

@Desertsnowman
Collaborator

The PHP codebox is for custom functions you want to use in your template. So define a function as you normally would, then in the html, you can call the custom function as normal by wrapping in <?PHP ?>

@sc0ttkclark
Owner

Any way we can simplify that to something like %%function_name:arg1|arg2|arg3|arg4%% or similar? So it'd be limited to calling functions like that? Would just like to limit usage of eval() and provide an alternative if someone wants to disable the PHP tab altogether.

@Desertsnowman
Collaborator

Agreed. If you click the help button, you'll see a few code tags I've already put in to simplify coding. Though not all implemented yet.

@sc0ttkclark
Owner

I have to say, this really blew Phil and me away, you did an awesome job on this and the UI.

@Desertsnowman
Collaborator

Wow, thanks. I'll refine the code more as I work it, it's mostly guess work while learning pods API.
I'll probably get back on it tomorrow when I get back to work.

@sc0ttkclark
Owner

For the slug field, try using echo PodsForm::field( 'field_name', $value, 'slug' ); and that will output a slug field, which enforces specific characters like spaces to be converted to dash. For the underscore equivalent, try echo PodsForm::field( 'field_name', $value, 'db' );

@Desertsnowman
Collaborator

Sweet thanks. I'll take a look. I still have a lot of work to do.

@pglewis
Owner

Yeah, I was pretty much gushing over the utility of this in chat last night. As a temporary real-world example, I setup a FAQ list:

http://pods2.sundco.com/advanced-template-faq-list/

  • Styling applied to the Q/A sections
  • JS behavior to slidedown/slideup when clicking the question
  • Implemented as its own shortcode, just dropped into content on a regular WP page
  • Automatically tied to the Pod data

Implemented entirely with a simple pod, a single advanced template, and the WP page itself.

You can set it up in minutes and all the related pieces for the implementation are stored and saved together (also handy for maintenance IMO, when you come back to it a year or more later).

Sure, there are edges to smooth out, but this is immediately useful. It's like Pods swallowed jsfiddle.

@pglewis
Owner

One quick question, is there a way to set dependencies by handle? I usually already have jQuery queued on sites and it's just a matter of setting the dependency in my enqueue_script(). To get things working I just shotgunned it and created a library entry pointing to a CDN copy.

@Desertsnowman
Collaborator

Wow, I'm glad you're finding it worthy.
and yes jsfiddle may have inspired me a little. Just wait till I get the live preview working :)
I'm going to add dependencies to the libraries. For now though you can drag the order around for a rudimentary way.

@sc0ttkclark sc0ttkclark removed the In Progress label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.