PHP package management history

Reading the great article Modern Javascript Explained For Dinosaurs made me thinking on how that would look like if we were to look at PHP’s history of package management and autoloading. A long time ago in a galaxy far, far away PHP 5 was released. It had numerous improvements compared with PHP 4 (while keeping backwards compatibility) but was still lacking a proper method of including/loading packages from other files....

08 February, 2019 · 4 min · 766 words · Alexandru Bucur

How to get the user role for the current logged in user in Wordpress

Quick and easy way of getting the current role in a Wordpress Setup 1 2 $current_user = wp_get_current_user(); $current_user_role = ($current_user->roles);

20 September, 2012 · 1 min · 21 words · Alexandru Bucur

Simple-Mvc-System-Drupal-6

I’ve recently started working on a custom module in Drupal 6 and I really disliked the idea to use built in functions for tables and/or to use embedded html into my module. So I’ve made a simple system on having a view like system in Drupal 6. Create a new module, and in the module folder create a directory called views (for eg:). Add the following function in your module...

24 May, 2012 · 1 min · 163 words · Alexandru Bucur

How to Change or Remove Views2 Exposed Button From Drupal

Add this to your template file: 1 2 3 4 5 6 7 8 9 10 11 12 13 function YOUR_THEME_NAME_preprocess_views_exposed_form(&$vars, $hook) { //this is important // only alter the required form based on id if ($vars['form']['#id'] == 'views-exposed-form-where-to-buy-page-1') { // Change the text on the submit button $vars['form']['submit']['#value'] = t('Search'); // Rebuild the rendered version (submit button, rest remains unchanged) unset($vars['form']['submit']['#printed']); $vars['button'] = drupal_render($vars['form']['submit']); } }

15 June, 2009 · 1 min · 67 words · Alexandru Bucur

Drupal Ubercart Get Add to Form

Quick and easy way on how to get ubercart’s form output for a node. 1 $output .= drupal_get_form('uc_product_add_to_cart_form_'. $node->nid, $node);

15 June, 2009 · 1 min · 20 words · Alexandru Bucur

Drupal 6 Custom Content Type Page Theme

If you ever wondered how to change the page.tpl.php for a custom content type you’ve found out that by default Drupal 6 doesn’t know how to do it. It’s “fixed” easily by adding the following code: 1 2 3 4 5 6 7 8 9 10 11 /** * Override or insert PHPTemplate variables into the templates. */ function phptemplate_preprocess_page(&$vars) { // Add per content type pages if (isset($vars['node'])) { // Add template naming suggestion....

04 June, 2009 · 1 min · 98 words · Alexandru Bucur

T_PAAMAYIM_NEKUDOTAYIM PHP Error

Ok so i’ve hit this nasty php error T_PAAMAYIM_NEKUDOTAYIM that sounded like a language from another planet for me (found out that it’s Hebrew for “missing double dots”) The problem is that with static class functions you can’t do dynamic loading (or at least it didn’t work for me) So while this 1 2 3 $module = $_GET['module'] $stuff = new $module(); $stuff->data; works, you can’t do 1 $module::data() even if the name of the module is the name of the class....

02 February, 2009 · 1 min · 82 words · Alexandru Bucur