drupal
Interesting tutorial on how to use the jQuery UI Dialog library that comes bundled with D7.
Take a look at this tutorial
This is a PHP function I wrote that helps simulating a drupal get form for Views Exposed Filters, it returns the exposed form array so you can theme it or alter it:
function _get_exposed_form($view, $display_id){
$view = views_get_view($view);
$view->set_display($display_id);
$view->init_handlers();
$form_state = array(
'view' => $view,
'display' => $view->display_handler->display,
'exposed_form_plugin' => $view->display_handler->get_plugin('exposed_form'),
'method' => 'get',
'rerender' => TRUE,
'no_redirect' => TRUE,
);
$form = drupal_build_form('views_exposed_form', $form_state);
$form_redered = drupal_render($form);
return $form_rendered;
}
I took this…
Read more...And this happens with Drupal too!
When creating a node that has for instance a field where you place the embedded code of a youtube video, once submitted the add form, on Chrome the video does not get displayed unless you refresh the page. Basically this is how Chrome prevents XSS attacks.
What i did to solve this momentarily ( workaround) is adding a Javascript refresh page condition on my template.php:
function my_theme_preprocess_html(&$variables) {
// on chrome we need to reaload the page so the uploaded video can be shown
// this is due how Chrome prevents XSS (cross-site scripting)
$u_agent = $_SERVER['HTTP_USER_AGENT'];
if(preg_match('/Chrome/i',$u_agent)){
$bname = 'Google Chrome';
$ub = "Chrome";
}
if($ub == 'Chrome')
$variables['attributes_array']['onLoad'] = "if (location.href.indexOf('reload')==-1) location.replace…
Read more...
The reason for this blog is to create a guide on how to install Drupal on a Linux Server ( I choose Ubuntu 10.04 amd64 LTS but any Linux distro will work just fine) but instead of using all the PHP packages bundled with this Linux distribution we will be using Zend Server which is an Application Sever built for PHP by Zend.
So, once you have set up Ubuntu, let's login as the root user typing the following command:
$ sudo -s
cool , now that we have all the privileges, let's add the Zend Server repository to our sources list by typing:
# nano /etc/apt/sources.list
at the end of the file add the following lines:
#Zend Server
deb http://repos.zend.com/zend-server/deb server non-free
save and exit.
Once we added the repository we also need to add the public key for it, we do…
Read more...Yesterday, I was working on a new requirement on a website I'm currently working on and the idea of it is make Drupal provide a Widget so anyone can copy/paste a single piece of HTML code inside a iframe and embedded that code anywhere, so providing ans iframe is not a big deal but of course the iframe will display inside it whatever comes from the source url you set for it, example:
<iframe frameborder="0" height="480" src="http://www.mysite.com/widget/"; target="_blank" align="center" width="360" scrolling="Auto"; bgcolor="#C9D3DE"> </iframe>
In this case "src" retrieves whatever content that url has, of course, this should be a single piece of html.
In order to do so with Drupal, you have to create a menu callback that will act as the provider of this piece of HTML code, something like this:
function my_module_menu(){
$items['…
Node referencing has been a great concept when working with Drupal content, it helps create complex references between nodes and it has been widely used, for example when you create a Photo Gallery. Having a Photo Gallery is pretty easy in Drupal, you need a content-type that will handle the information of an album or gallery and another content-type that will handle the images information. Using Node References will attach those images to your Albums. How? using this module in Drupal 7:
Of course, by default you won't have a nice way to identify which of the referenced nodes you want when creating a Album, but I found this project pretty straightforward in order to handle that lack
Read more...