Tag: drupal

Taxonomy pagina’s ontoegankelijk maken

Standaard zijn taxonomy pagina’s altijd te benaderen via taxonomy/term/. Dit is niet altijd wenselijk en kan via de template.php worden ondervangen. De vraag is of dit de meest aangewezen plek is, maar het functioneert!

De oplossing is om de taxonomy_term_page() functie te overriden

function <theme>_taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {}

Door dan de drupal_not_found(); functie aan te roepen, worden deze pagina’s automatisch voorzien van 404 meldingen.

function <theme>_taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_not_found();
}

Je kan natuurlijk ook per vocabulary een uitzondering maken en daar een view-output op laten zien.


// we need to know the vid, so we ask for more information about the term
$term = taxonomy_get_term($str_tids[0]);
if($term->vid == <your_vid>){
$output = views_embed_view('bedrijven_overzicht','block_1',$term->tid);
return $output;
}
else{
drupal_not_found();
}

Ik hoor graag als er andere, betere, mooiere manieren zijn, maar het heeft voor mij in ieder geval zijn doel bereikt.

Single Invoke Cronjob Drupal with SuperCron

If you use SuperCron for Drupal (who doesn’t?!) you can call the different invokes seperately. Very handy if you would like to check if there’s email via mailhandler every 10 minutes, without running the complete cronjob.

How? You will have to find the key named SUPERCRON_SAFETY_VARIABLE and this key can be found in the database table variables.

And then? You put in a cronjob for example like this http://example.com/supercron.php?safety=<your_found_key>&module=<the_module_you_want_to_invoke>

UPDATE: ok. that was too fast! the variable changes on every cron run, so this doesn’t work! I’ll post an update soon!

Get the value for a key [CCK / Views]

I was trying to get a value in a views tpl. The value was a predefined list of text values. Views gave the key value, but of course i needed the string value.

content.module contains the function content_format() which does the job for you. More information about this function: http://api.audean.com/api/function/content_format/API+Reference