…html.twig'); } public function otherAction() { return $this->render('CrawlingFtestingBundle:Crawling:other.html.twig'); }The TemplatesNow we need to create the template files for these controller actions. Under src/Crawling/Ftesting/Resources/views, create a new directory named Crawling to hold our CrawlingController's template files. Inside, first create the home.html.twig file, with the following HTML inside:<h1>Crawling Home Page</h1> <p>Here's our…
…html * Domain Path: /lang * Text Domain: paypal-buy-now-button-shortcode */2. Creating the ShortcodeStep 1You'll now begin by creating a new function with attributes, called paypal_buy_now_shortcode( $atts ), and opening up the function./** * Generates the markup for the shortcode on the public site. */ function paypal_buy_now_shortcode( $atts ) {Step 2Next, you'll…
…HTML tags, and encode the information to be saved $drafts = trim( $_POST['authors-commentary-drafts'] ); $drafts = esc_textarea( strip_tags( $drafts ) ); // More to come... }Here, we're looking to see if the content of the $_POST array is populated. If so, we then sanitize the information using trim and esc_textarea.At this…
…HTML tables. It's a nice way to provide sortable, scripted tables that don't require the user to refresh the page. You can also use it when you're using Ajax in your application.This tutorial will showcase actual code and three examples of using Tablesorter. You can download the code at GitHub. Note that…
…What You'll Be CreatingWelcome to the second part of our series on generators and Koa. If you missed it you can read read part 1 here. Before starting with the development process, make sure that you have installed Node.js 0.11.9 or higher.In this part, we will be creating a dictionary API using Koa.js,…
…HTML form for creating a Status item. Check out the _form.php in /app/protected/views/status/.First, I'll load several jQuery and JavaScript libraries for character counting:$baseUrl = Yii::app()->baseUrl; $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($baseUrl.'/js/jquery.simplyCountable.js'); $cs->registerScriptFile($baseUrl.'/js/twitter-text.js'); $cs->registerScriptFile($baseUrl.'/js/twitter_count.js'); I used a combination of the jQuery simplyCountable plugin, twitter-text.js (a JavaScript-based Twitter text-processing script) and a script that…
…HTML by using this code: <?php add_filter( 'the_editor_content', 'the_editor_content_example' ); function the_editor_content_example( $content ) { // Only return the filtered content if it's empty if ( empty( $content ) ) { $template = 'Hey! Don\'t forget to...' . "\n\n"; $template .= '<ul><li>Come up with good tags for the post,</li><li>Set the…
…HTML tags, and encode the information to be saved $drafts = trim( $_POST['authors-commentary-drafts'] ); $drafts = esc_textarea( strip_tags( $drafts ) ); update_post_meta( $post_id, 'authors-commentary-drafts', $drafts ); } else { if ( '' !== get_post_meta( $post_id, 'authors-commentary-drafts', true ) ) { delete_post_meta( $post_id, 'authors-commentary-drafts' ); } } // If the 'Resources'…
…HTML If you want to be able to send HTML emails, you can use the code snippet below to change WordPress' content type for emails: <?php add_filter( 'wp_mail_content_type', 'wp_mail_content_type_example' ); function wp_mail_content_type_example( $content_type ) { return 'text/html'; } ?> Saving the IP Address of the Commenter WordPress saves the IP…
…What You'll Be CreatingWhile the Twitter REST API is suitable for many applications, if you want immediate updates and access to a broader array of notifications, the Twitter Streaming API is essential. For example, only the streaming API will tell you when another user favorites one of your tweets.Using the…