Closed DavidCramer closed 6 years ago
Toys! I'll definitely be looking at this, a nice feature set for sure.
How do you call PHP blocks from the HTML tab?
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 ?>
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.
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.
I have to say, this really blew Phil and me away, you did an awesome job on this and the UI.
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.
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' );
Sweet thanks. I'll take a look. I still have a lot of work to do.
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/
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.
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.
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.
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.