drupal tips

Validation file in Drupal without theme / template

 

Sometimes you need to upload files to, for example, validate an affiliate with whom you want to start to work.

The problem, is that these affiliate files need to be "clean", no template, no theme, just the code or validation string which they send.

The solution can be very complicated, like creating a new theme just for a group or a contect of pages... or as simple as creating a node with the string which we need and executing a php code with an exit command. Something like this:

 

valicationStringLikeUZasdBNf6asdfT2asdfafjpdadf===58QYg==

<?php

exit;

?>

 

so, when you open this node, you'll see a blank page like the one in the screenshot.

Well, i don't like to use php inside nodes, this practice must be avoided, but for this case, the code is enough simple and, the most important thing, it doesn't break the cron execution. So, everyone happy :-).

Do you have a different or improved idea for this? Please, share :-)

 

Meta tags and custom title in views

Has ever need to insert a custom title in your drupal views? Or need to use meta tags in this so important for your project, views results?

A extremeley flexible solution can go throug creating your own custom views templateviews-view.tpl.php (or views-view--NAME-OF-VIEW.tpl.php). Then you can use the Drupal api to insert whatever you want, title, meta tags, ...

Example:

<code>drupal_set_title('bodas');

</code>

or even more flexible:

<code>if(arg(1)) drupal_set_title('bodas en '. arg(1));

else drupal_set_title('bodas');

</code>

And more "magic", meta tags in views:

<code>drupal_set_html_head('<meta name="keywords" content="bodas, '.arg(1).','.arg(2).'" />');

if(arg(1)) drupal_set_html_head('<meta name="description" content="listado de empresas de bodas" />');

else drupal_set_html_head('<meta name="description" content="listado de empresas de bodas en '.arg(1).'" />');

</code>

That was my friday tip :-).

More tips link: http://foreverheavy.com/10-quick-and-dirty-drupal-tips/