Wordpress - Why use shortcodes_att

I'm actually wondering what is the purpose of the function : shortcode_atts Because it's possible to write : $a = shortcode_atts( array( 'Title' => 'Title' ), $atts ); or without using this function : $a = $atts['Title'] ? $atts['Title'] : ""

Declarations of variables in PHP OOP

Is it necessary to declare variables in PHP at the class scope before using them with a $this->variable reference? Or is $this->variable usage enough to declare the a class variable within a method? For example using: class MyClass { public function

Redirect the URL to another

I am using an AWS EC2 instance to host a website. I have an installation under /var/www/html/xyz/ dir & thus if I have to access website homepage, I have to specify link as www.example.come/xyz. I want that www.example.com should be redirected to www

to set variables to twig when the redirect link?

i want to set a variable to twig when redirect link like when use the render methods : return $this->render('socialBundle::index.html.twig',array( 'id' => $id )); it will set the Id variable to twig : {{ id }} return $this->redirect($this->gen

How to select the result between two range numbers?

I need to select the result based on the column col1 value. col1,col2 is text field type. +-----+-----------+------+ | id | col1 | col2 | +-----+-----------+------+ | 1 | 1200-1220 | XXX | +-----+-----------+------+ | 2 | 1455-1460 | YYY | +-----+---

How to conditionally merge a multidimensional array

I have a multi-dimensional array: Array ( [10] => Array ( [from] => Jack [to] => Terry [Bribe] => 0 [Joke_Payment] => 0 [Corrupt_Support] => 1 [Legitimate_Support] => 0 [Obfuscation] => 1 [Legal_Enforcement] => 0 [Whistleblower]

Manage an array of ajax return objects

This is the ajax part that i think is causing the problem: $.ajax({ type: "GET", dataType: "json", url: "./php/censusdata2.php", success: function (data) { createMarker($list.data.lat, $list.data.lng, map, $list.data.FORENAME

Simplify an If / Else statement with null checks

I'd like a way to simplify an if/else statement that concatenates two values together, but also checks for null values before using the variables. For example: if (isset($A,$B)) { $C = $A . $B; } elseif(isset($A)) { $C = $A; } elseif(isset($B)) { $C

Facebook PHP SDK 4.0 Sign in

I am trying to get Facebook login with their new PHP SDK 4.0 working for my site. I followed their gist almost verbatim and still can't even get a test page to work. When I try to log in, I get redirected to a url of the form: https://www.facebook.co

Edit text in the dynamically created text box

I have a bunch of textboxes that are created dynamically one per click. They all have the same name "discount[]", same id "discount" and have the same class "tinput". Is there anyway that I can use to change the text in all o

What is the problem with this code? (Drupal)

I use this code in my subtheme page--front.tpl file, but I can not see any message on my front page like my code bellow. <?php $flag = drupal_is_front_page(); if ($flag) { drupal_set_message("Welcome to front page of this site."); } else { dr

Should loops with logic and html output go in style or view?

I'm new to OOP and MVC and currently building a website using CodeIgniter. There seems to be a lot of contrasting information about whether loops should be in the view or the model. On the one hand I'm trying to keep all my html markup inside the vie

Go to line number

I have successfully connected my php script to a transbase database with odbc. Here's a simple question I am not able to find an answer: how can I jump to a specific row number in a result set? EDIT: This is how I'm going through the result set while

Magento joins different tables

I have the following code in my Grid.php file: function _prepareCollection () { $collection = Mage::getResourceModel($this->_getCollectionClass()); $collection->getSelect()->joinLeft( array('sfog' => 'sales_flat_order_grid'), 'main_table.entit

Build an RSS feed in Code Igniter

I want building an RSS Feed but my output not true, how can fix it? i use this tutorial:http://www.derekallard.com/blog/post/building-an-rss-feed-in-code-igniter/ Please see my full code in following: CI_Controller: function rss_feed($limit = NULL) {

How can I pass multiple ajax variables to php?

I'm trying to pass two variables into this AJAX function, how would I go about doing that? function showInfo(str) { if (str=="") { document.getElementById("txt").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for

Left Join 1 table to several tables in MYSQL

I have 4 tables, which are linked together with a foreign key from another, eg Table 2 has fk_table1, Table 3 has fk_table2, Table 4 has fk_table3. The first 3 tables in this chain all have corresponding data for each entry. However, Table 4 contain

twilio php sequential numbering

I am planning on building a sequential dialing twilio program and so far I have a little bit of code and I am a little stuck....What should I do or can I do to make Twilio call a number, if that number doesnt pick up call the next number in the array

Retrieve the mysql data and update it accordingly

I want to retrieve data from my MySQL database and display it as a table (I don't mind any style, but preferred as a table). Then the data should display with a radio button or a normal button which update that specific row and changing a single colu

PHP: combine the text after the explosion

Using explode I broke up the text into pieces, then us the foreach to look for a few thing in the text. $pieces = explode(' ', $text); foreach ($pieces as $piece) { Some Modification of the piece } My questions so how can I put those pieces back toge

OOP database and practices in PHP

Its difficult to explain this situation but please see the example. I have coded a website where the page loads, I initialize a database class. I sent this class as a function parameter to any functions that needs to access database. I know this is b