modX snippets to Drupal
avibodha - October 29, 2009 - 06:12
hi, moving a site from modX.
modX has code 'snippets' that you can place in content to have programmed output....similar to blocks, but not tied to a region...
is there anything similar in drupal...or if I want some processing, do I need to make a block and then assign it a region? wouldn't this lead to many many blocks?
for example, I want a video block that I can place in content where I want...or other types of things like that.
or is the best way to turn on PHP in content and just make a function that returns html?...and put that code in my template directory maybe?
any advice? thanks for any input.

Have you tried Views?
You can add PHP snippets to any node or block by enabling the PHP Filter module, but if you haven't already, you could also try the Views module. It's not exactly the same as modX snippets (Views has an admin UI for building queries), but the final result is similar and it's extremely flexible.
thanks...I thought that was
thanks...I thought that was for presenting queries...but sounds like it can be used for any php code...yes, I'd rather not put php into nodes...just some way to keep them organized and editable...
thanks
There are various options
Yes, Views is a query builder. Sorry, I was assuming that's what you wanted, but it's very flexible and well worth checking out.
The problem for you is that there's no exact equivalent of modX snippets in Drupal. Some customisations need to be done at the theme level by customising templates. Others can be done with the regular admin UI, or perhaps Views. Or you can add PHP to a node, which is fine if you keep permissions to the PHP Filter highly restricted and restrict access to the node via a module such as Content Access. Or you can even create a full module (although it's well worth checking the many contributed modules first).
If you can be more specific about your request, perhaps someone could point you in the right direction. And if you haven't already, you could also check out the Drupal handbooks too.
thanks glennr, that is
thanks glennr, that is actually a lot of what my snippets do so that helps a lot.
yes I think I'll make a module to hold all the other non-query type things that get inserted...maybe they will be blocks each...
One thing that's different about drupal is it forces you to work at a bigger level (blocks, regions, views). In modX you can get so granular (small chunks of snippets here and there). Not bad, just different....but most of the modx snippets are just like views.
thanks for your help.