I want to load a controller from a function in another controller because the library I integrated to my project I don’t want to load it to the controller because I want to keep it clean and related. I tried using modules but I still had to put controller in the url like http://example.com/maincontrolle…
Tag: php
Magento: Retrieving uncached system configuration values
I have a script that sends order data to a 3rd party system via a RESTful web service. This system demands that a unique ID is sent with each request, which is autoincremented from the next. I’ve …
Remove stylesheet selectively in Drupal for page
I am trying to make different layout for the front page. In that process I declared new stylesheet called “front-page.css” and page–front.tpl.php. I am using a Zen subtheme which loads responsive-…
Is There A Way To glob() Only Files?
I know that glob can look for all files or only all directories inside a folder : But I didn’t found something to find only files in a single line efficiently. Works well but reads directory twice (even if there are some optimizations that make the second browsing quicker). Answer I finally found a solu…
PDO fetch / fetchAll
Not new to PHP, but only a day old to PDO. Surely I am doing something wrong here. the only way I can declare those $_SESSIONS properly is if I use $result[0][‘fieldName’]; How can I just access it via $result[‘fieldName’]; ? Answer fetchAll, as the documentation says, retrieves an arr…
PDO connection : UTF-8 declaration with SET NAMES / CHARACTER SET?
According to php.net, Stack Overflow and other sources of trust, I can find 4 different ways to set UTF-8 on PDO connection, but can’t find which one is the better to choose: $pdo_db = ‘mysql:host=…
Heroku: PHP Fatal error for valid function – mb_check_encoding
I have the following statement: This works on my local setup of PHP 5.4.17 and my shared host which has PHP 5.3.xx But when I deploy this app to Heroku (which has PHP 5.3.10), it gives the following error in the logs: 2012-12-26T09:55:28+00:00 app[web.1]: [Wed Dec 26 09:55:27 2012] [error] [client 10.119.79.7…
Crop local image file
I got a form that allow user to upload image and crop it I already figured out the flow of it 1.User upload the image 2.Server process it and send back to the browser 3.User crop it and send to the server 4.Server process and save it Is there any other way to achieve this? Perhaps using javascript to load
understanding why echo doesnt work within a php class function
I’m trying to debug a class and using print_r and echo to view the variables as the script progresses. However for some reason I can’t seem to get any output from within the function, i’ve declared the function public but can’t get any output using print, echo or print_r. I’m mis…
How do I pass the name of the radio button to the Javascript for the onclick event?
I have an html table having n rows. Each row has a name and 2 radio buttons. If I click a radio button, I want to show an alert that states the count of votes. How should I pass the name of the radio …