• Awning Works 1
  • Socaz 2
  • Socaz 1
  • Randy Montana 3
  • Randy Montana 2
  • Randy Montana 1
  • Rodgers & Hammerstein 3
  • Rodgers & Hammerstein 2
  • Rodgers and Hammerstein 1
  • Love Fine Art
  • Jan
  • 30
  • 2012

DRUPAL 7: How to Expose a Field in Views

DRUPAL 7: How to Expose a Field in Views

The other day when trying to expose a Filter criteria in a view of the Views module 7.x-3.1, I was frustrated by the fact that it would not function despite my best efforts. After triple checking my set up and reading a lot of documentation, there was no fix. Finally, after digging deep into some threads by a person having the same frustration with Views in Drupal 7 and exposed filters, I found the simple, although illusive, solution.

In the VIEWS UI, open the “ADVANCED” section and look under the “OTHER” subsection. Find the item “Use AJAX” and set the value to yes. I know, I know, (pause, make face) – right? Well, the guy on the thread that helped me complained enough about it so I’ll just keep my mouth shut.

I hope that if you were having this problem you found my post faster than I found that thread. : )

As, always, feel free to comment and make suggestions.

select yes for use ajax

  • Jan
  • 03
  • 2012

Get The Calling Function

Knowing which PHP function call the code we are working on can give us the clues we need for de-bugging a script.
Getting the calling function is easy in PHP, thanks to the debug_backtrace() function.

Just put the following code wherever in your script you need to know what function is calling the part you are working on.

45
46
47
48
49
50
<?php>
 
$backtrace = debug_backtrace();
print "The function that just called this code is <strong>" .$backtrace[1]['function'] . "<strong>.";
 
</php>

This will output something like this:

The function that just called this code is DrawWidget.

Where DrawWidget is the name of the function.

I hope this comes in handy for someone. Thanks for visiting!

  • Jul
  • 03
  • 2009

Screen shot of the up and comming CPI Data Panel

Posted by admin In AJAX, CSS, MySQL, Web Design | No Comments »
Screen shot of the up and comming CPI Data Panel

I havn’t posted in few weeks because I have been very busy with several projects. One of the projects I am particularly excited about the CPI panel. The Cpi panel is new “back end” for LoveFineArt.com. IT used to be that each and every product would take about 20 minuets to enter. With this new panel (incorperating secure AJAX), The products can be entered as fast as the site owner can type!

Here is a screen shot of the new back end.

Screen shot of the up and comming CPI Data Panel

I have also been busy learning the Drupal platform. AS I become more knowledgeable there will be posts and perhaps a special section on this blog devoted to cool new drupalistic methods and problem solving.

AS always, I invite you to leave a coment or sugestion or critisizm.

  • May
  • 15
  • 2009

Dynamically Change the onClick, onChange (or other) Value of an Element

If you are implementing AJAX, you will likely run into the need to change the functionality of a button dynamically. There is not a whole lot out there on how to quickly accomplish this so here is a simple explanation.

Typically, you have an element such as an “input”, “a” or “select (options)” that has an attribute of “onClick”, “onMouseOver” or “onChange” with a value of some function that will execute upon the event represented by the attribute.

UPDATE: This has been changed to accommodate ie. The following way will work in both Firefox and Internet Explorer:

button_element.onclick = function() {doSomething();};

Thanks! to this post. (note: the answer is at the bottom of the post after some discussion.) Thanks for sharing

To assign a new value to the attribute, you need to identify the element you want to change like this:

elem =  document.getElementById(“myElementId”)

Then simply assign the new value to the attribute like this:

elem.attributes["onclick"].value = “myUpdatedFunction(‘My parameter’)” ;

Now, if someone clicks on the element, the new updated version of myUpdatedFunction() will be called. Notice that you can even pass a parameter to the function this way. Just be sure to nest your quotes properly.

This method will also work for other attribute types such as onMouseOver, onChange an so on.

I hope this helps.

  • May
  • 07
  • 2009

How to Protect Against SQL Injection

Posted by admin In AJAX, How To, MySQL, PHP, Web Security | No Comments »
How to Protect Against SQL Injection

One of the most common web security problems is SQL Injection. As the name implies, SQL injections works by introducing malicious SQL code where it doesn’t belong. Since it is SQL code you could probably guess that the attacker “injects” his poison via database queries. Web developers often pass some sort of variable to their database queries. Very common are variables that are influenced by user input. User input, to variable, then to query,- get it? So, there is a need for a way of eliminating the user’s ability to manipulate the variable in any way that could effect the query.

What Happens With SQL Injection

By passing an unexpected string of code into a user input, such a form, an attacker send damaging code that causes an otherwise good query to go haywire. For example:

  • May
  • 01
  • 2009

What is AJAX

Posted by admin In AJAX, Web Design | No Comments »

Asynchronous Put the “A” in AJAX
The key word is asynchronous.
“1.  A process in a multitasking system whose execution can proceed independently, “in the background”. Other processes may be started before the asynchronous process has finished.”—Dictionary.com
Most web pages are rather “choppy” because they need to “refresh” themselves, which is a nice way of saying completely re-load the entire page. This must happen every single time they need to “refresh” their data from the server. You probably have figured out by now that this takes time. What AJAX does is allow a web page to asynchronously update only the portion of the web page that is actually in need of fresh data instead of the entire page. Not only is it much faster, but the effect is that it is much smoother. This is because your eye does not have to endure the “flicker” or “hang ups” of the complete page re-load. Sometime the transaction is so smooth that the user often has no idea that it has happened. Knowing that you have affect

Flickr Stream