php

How to cast a value as integer in Smarty

Im having a little trouble in referencing indexes in arrays in Smarty. I believe that it is because the variable I am using as the index is a string. How may I cast this string as a integer within the template? Thanks. ...

PHP's SimpleXML: How to use colons in names

I am trying to generate an RSS Google Merchant, using SimpleXML. The sample given by Google is: <?xml version="1.0"?> <rss version="2.0" xmlns:g="http://base.google.com/ns/1.0"&gt; <channel> <title>The name of your data feed</title> <link>http://www.example.com&lt;/link&gt; <description>A description of your content</description> <ite...

Check for repeating dates.

I am creating a calendar in PHP and in the database have a date, let's say 6-10-10. Sometimes I have repeating events, stored as weekly repeating, so if the date is 6-10-10, and I am repeating an event every two weeks from that day (including that day) what is the best way to find dates for every two weeks from 6-10-10? For example, le...

CakePHP - hasMany not fetching?

Maybe I am just having a slow day, but for the life of me I can't figure out why this is happening. I haven't done CakePHP in a while and I am trying to use the 1.3 version, but this doesn't seem to be working... I have two models: area.php <?php class Area extends AppModel { var $name = 'Area'; var $useTable = 'OR_AREA'; ...

Difference between Class Abstraction and Object Interfaces in PHP?

What is the difference between a Class Abstraction and an Object Interfaces in PHP? I ask because, I don't really see the point to both of them, they both do the same thing! So, what are the advantages of disadvantages using both against one or the other? Class Abstraction: abstract class aClass { // Force extending class to define...

Can someone explain "access arguments" in Drupal?

Trust me I have tried Googling it but I am just not getting a clear grasp. Thank You. ...

MySQL Insert not working with Date column

Hello All, I am having an issue with a simple insert query into a table. I have this PHP Code $T_MEMBER = "INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('$memberID','$last','$first','$birthdate')"; mysql_query($T_MEMBER) or die(mysql_error()); Here are a few examples of what the query looks like...

Webkit and Excel file(PHPexcel)

I have an excel file which can be downloaded..for example NAME.xlsx well it works in firefox but in webkit(safari/chrome) it appends to the name also the extension .xhtml so then name it will be NAME.xlsx.html it should be ONLY .xlsx Here you have my headers: $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); ...

Restrict allowed file upload types PHP

Right now I have a function which takes my uploaded file, checks the extension, and if it matches an array of valid extensions it's processed. It's a contact list importer. What I need to figure out is how to be sure that file (in this case a .csv) is actually what it says it is (ex. not an excel file that just got renamed as a .csv). ...

PHP Editor that able to trace dependency of all function in a file with models/controllers or another part of a framework (or something we had code)

hello a friend of mind ask something about php editor for his companion on coding. PHP Editor that able to trace dependency of all function in a file with models/controllers or another part of a framework (or something we had code). Basicly we use notepad++ but seeking another alternative. ...

Add Facebox To FullCalendar Events

I have been trying to make the FullCalendar events use Facebox to pop up with information when they are clicked. I have no problem putting the events on the calendar or getting the information that needs to be displayed it is just getting the pop up box to work. I have tried adding rel="facebox" to both the "span" and the "a" that wraps...

wordpress image showing up multiple times

I am writing a wordpress theme, and have run into a fairly basic problem. By default, when you inset an image into the post, it displays that image at the size you specify, on both the homepage and the single post. I would like to have different sized images, displaying a thumbnail on the homepage, and a full sized image when you click ...

How can I disallow all HTML using markdown (PHP and JS)?

I'm using the PHP markdown library: http://michelf.com/projects/php-markdown/ and the Javascript markdown library: http://attacklab.net/showdown/ I want to disallow all HTML, both the versions of markdown seem to allow it indiscriminately. My first attempt was simply to escape all html entities before feeding into markdown. However this...

Limit String Length

Hi, I'm looking for a way to limit a string in php and add on ... at the end if the string was too long. Thanks :) ...

Getting url of images given a word in PHP

Hello, I'm developing a program whose background image will change in relation to the trending topics of twitter. So I have a function which returns me a word (first TT on twitter), then I need another function that will give me a url of an image relative to that word, like Google image search or flickr. Do you know how to do this? or ...

Local web apps and W3C standards.

If am writing a local app that will only run using a specific browser, am i setting my self up by slightly ignoring W3C's standards? I ask this question because in this app i am thinking of using custom HTML tags, custom attributes, etc... Thanks in advance guys. ...

Uploading a picture to facebook

Hi guys, I am trying to upload a image to a gallery on a facebook fan page, here is my code thus far, $ch = curl_init(); $data = array('type' => 'client_cred', 'client_id' => 'app_id','client_secret'=>'secret_key',' redirect_uri'=>'http://apps.facebook.com/my-application/'); // your connect url here curl_setopt($ch, CU...

Permutations of Varying Size

I'm trying to write a function in PHP that gets all permutations of all possible sizes. I think an example would be the best way to start off: $my_array = array(1,1,2,3); Possible permutations of varying size: 1 1 // * See Note 2 3 1,1 1,2 1,3 // And so forth, for all the sets of size 2 1,1,2 1,1,3 1,2,1 // And so forth, for all the...

Validating forms with regex in codeigniter

How can I validate a form using regex in codeiginiter. I'd like to check the input against: ^([0-1][0-9]|[2][0-3]):([0-5][0-9])$ I'm assuming the best way is in some sort of callback. I tried a bunch of ideas on the web but I can't seem to get any working. ...

Need help Decoding JSON with XML

I have a set of data that looks like this when using print_r($var): cbfunc({"query":{"count":"12","created":"2010-06-11T01:20:19Z","lang":"en-US"},"results":["\n 238.l.739089.t.4<\/team_key>\n 4<\/team_id>\n CHEE-HOO!!!<\/name>"]}); It looks like JSON to me, so I've tried to use json_decode but can't get it right. My goal is to prin...