Category 'Tutorials'


Create a simple Feed Reader with SimplePie and jQuery

SimplePie is a PHP library can greatly simplify the retrieval and manipulation of RSS feeds, or, more generally, to XML formats. You can, for example, write a few lines of code, exploiting some "funzioncina" jQuery to create a News Ticker to join our site / blog.

Continued ...

How I Did It: How to Create a sticker-ribbon in 3 steps

The stickers (or ribbon) are those images that are placed in the upper right or upper left, and commonly have a form angular range. There are various types, from simple static images to the most spectacular Flash movies. Sometimes they are constructed so as to stay in position even when scroll the browser window.

Continued ...

Adobe AIR and the API Feedburner: reloaded

I draw inspiration by the excellent tutorial Napolux , Flex 3, Adobe AIR and the API Feedburner , which shows how to write a simple application (or widgets) using Flex 3 Adobe AIR, to show how to accomplish the same thing using Adobe Flash CS3. If you wish, and you can also use the extension for creating Adobe AIR applications. It is not necessary for the purposes of this tutorial, complete the application as an AIR executable, you can use the proposed code as a simple Flash movie to be "affixed" to your Web pages

Continued ...

Actionscript 3.0 for beginners: lesson # 4

Recall the example of our code of TicTacToe (found in full on Google Code ) and begin to analyze it in detail.

Import definitions

With Actionscript 3.0 has done a great job of cleaning and accommodation nell'alberatura classes (contained in the packages, package ) used during development. In other programming languages, like C for example, when you want to use a feature must explicitly "import" in the code. This operation of "import" is necessary to allow the compiler to have all the codes and definitions related to the features we want to use. ; Actionscript 3.0 mette a disposizione l'istruzione include che è identica all' #include del C/C++. In ActionScript 3.0, however, education import should not be confused with the equivalent C / C + + #include , Actionscript 3.0 provides education include that is identical to ' #include in C / C + +. The latter, in fact, "include" the actual code that, if used or not, the final executable is compiled. The statement import is the highest level and is more "intelligent" at compile time. It is used primarily for access classes without specifying their full name. In alre words instead of using forms such as:

1
flash.display . MovieClip = new flash.display . MovieClip ( ) ; var myMC: flash.display. MovieClip = new flash.display. MovieClip ();

Continued ...

Wordpress: remove the menu administration

It can be useful at times, "obscure" some WordPress administration menu, especially if you developed a site / blog for a client and do not want to allow access to particularly sensitive features. There are already plugins that perform this function but, for personal control and complete, we see how this feature works in detail.
As always we use the very useful Action provided by WordPress, in this case admin_menu . Using the global variable $menu can access the administration menu list. We can find the menu to "eliminate" in two ways: through the label or through the link that it points to (see annotated games in the example below). In this example are "blacked out" menu items Design, Settings, and Plugins:

1
2
3
4
5
6
7
8
9
10
11
12
13
remove_menu_item function () {
; global $ menu;
/ / By label
array ( 'Design' , 'Impostazioni' , 'Plugins' ) ; Removes $ = array ('Design', 'Settings', 'plugins');
/ / By link
/ / Removes $ = array ('themes.php', 'options-general.php', 'plugins.php');
$removes as $todel ) foreach ($ as $ Removes todel)
$menu as $key => $sm ) if ( $sm [ 0 ] == $todel ) { unset ( $menu [ $key ] ) ; break ; } foreach ($ menu as $ key => $ level) if ($ sm [0] == $ todel) { unset ($ menu [$ key]) break;}
/ / By link
/ / Foreach ($ menu as $ key => $ level) if ($ sm [2] == $ todel) {unset ($ menu [$ key]) break;}
}
/ /
, 'remove_menu_item' ) ; add_action ('admin_menu', 'remove_menu_item');

The use of links as a key to the removal ( $sm[2] commented in the code share in surprise), is useful when you are not sure of the language - localization - with which you installed WordPress. With this technique, however, the menu is removed only at the interface, so you can still access the site via a direct link.

Continued ...

jQuery: round edges on the images to overlap

Because of the different rendering across browsers, Microsoft Internet Explorer definitely see that in mind, we must always resort to tricks to apply special effects that now should be a standard. The award-discussed rounded edges are a classic example of "disaster" produced by the complete inability to make a serious standards on page rendering HTML / CSS. , etc… There are many solutions that allow the network to obtain the "effects" (effects of exempting existing HTML as rounded edges, shadow effects, reflections, etc ...) with patches on the leaves of styles, special tricks with the use of div grafted, libraries JavaScript, use of canvas , etc ...
On a purely technical teaching I would like to explain further (cross-browser) to apply the rounded edges of the images:

Demo and source

Continued ...

WordPress: step by step how to create their own login

In this tutorial we will see how to create a personal login procedure, also using Ajax functionality via jQuery . ). There are several ways to customize the login of WordPress, for example by the use of hooks and filters ( add_action() , add_filter() ). Here we will use a lower-level procedure, although there still interfaces to the kernel of WordPress. In addition we will attempt to validate a user through the dupla email / password.

Why create their own login?

  • In some contexts can return uitle have maximum control on the login page, to propose a custom layout to our registered users. You can also enhance the page with useful information, a logo from the classic "Lost Password?"
  • To allow access via the email (as in the example discussed here) instead of user_login standard WordPress
  • To be able to enter a login panel in the sidebar of our blog
  • And finally, to have a skeleton - and an idea - a great Plugin : D

Environment

In our example / tutorial we will work on the root of a folder inside of WordPress mylogin . . We create two php files within this folder: index.php and logon.php . The first will contain our login interface with all functions JavaScript / jQuery we need. The second file, logon.php , will contain the code for user validation. e una cartella images . Then create a folder css and within this file layout.css and folder images . Inside the images folder insert a classic Ajax loader: create it online AjaxLoad.info . At the end you should have:

  • mylogin
  • index.php
  • logon.php
  • Feed
  • Layout.css
  • images
  • ajax-loader.gif

Continued ...

Very short trick: undefined values ​​in Javascript

Is there a shortcut to assign "on the fly" a value to a variable if one is not defined (undefined), using the logical OR operator (| |) - double pipe:

1
2
3
4
5
/ / Bar is undefined
var bar;
pluto || '5' ; var foo = bar | | '5 ';
pippo ) ; alert (foo);
/ / Result: 5

Continued ...

WordPress: improving the list of comments

The standard template of WordPress (as others) normally provide for an alternate layout for the list of comments. In the standard template of such a class is set css alt , according to the logic:

1
2
3
4
5
/ / File comments.php
$oddcomment ; ?> id="comment- <?php comment_ID ( ) ?> "> <Li <? Php echo $ oddcomment;?> Id = "comment-<? Php COMMENT_ID ()?>">
[...]
/ * Changes every other comment to a different class * /
Oddcomment = $ (empty ($ oddcomment))? 'Class = "alt"':'';

) e una volta a class="alt" . This means that the tag li $oddcomment is set once a blank ( "" ) and once a class="alt" . A modification could be useful to introduce another class when the author of the blog to comment on a post:

image

I, for example, I used the following code in the comments.php file:

1
2
3
4
5
<Php
( $comment -> user_id == 3 ) ? ' Authcomment = $ ($ comment -> user_id == 3)? ' '' ; authcomment ':'';
( empty ( $classcomment ) ) ? ( ( $authcomment == '' ) ? ' alt' : '' ) : '' ; Classcomment = $ ( empty ($ classcomment))? (($ authcomment =='')? 'alt':''):'';
?>
?> <?= $authcomment ?> " id="comment- <?php comment_ID ( ) ?> "> <Li class = "<? = $ Classcomment?> <? = $ Authcomment?>" Id = "comment-<? Php COMMENT_ID ()?>">

del vostro utente. The line $comment-&gt;user_id==3 may vary according to ' ID of your user. I, for one, do not use the administrator to respond on the blog, but I have my user ID=3 . , se usate questa utenza potete scrivere: $comment-&gt;user_id==1 . Normally the ' ID of the administrator is 1 , if you use that user can write: $comment-&gt;user_id==1 . In this way, besides having the alternate layout on comments left by visitors, the answer is immediately recognizable author of the blog.

Continued ...

Very short trick: faster loops in Actionscript

In Actionscript cycles for it is good to use them with care. For example, you should use variables uint when you can:

1
2
3
var i : uint = 0 ; i ++; i < 100 ) { for (var i: uint = 0; i + +; i <100) {
/ / ...
}

You can also use the - not always known - the form:

1
2
3
4
5
uint = 0 ; var i: uint = 0;
/ / ...
; i ++; i < 100 ) { for (; i + +; i <100) {
/ / ...
}

Continued ...



Stop SOPA