php

using XML with PHP

I've got a little problem with an XML file. I need to take the content of the tags (in the XML file) and save them in a MySql data base , using PHP . My supervisor asked me to use DOM, but everything I do isn't workin'. My XML file looks like this : <?xml version="1.0" encoding="windows-1252"?> <BIENS> <BIEN> <CODE_SOCIETE>0024</CO...

PHP string transform first character uppercase/lowercase

I have two types of strings, 'hello', 'helloThere'. What I want is to change them so they read like: 'Hello', 'Hello There' depending on the case. What would be a good way fo doing this? Thanks ...

How to merge two MVC systems in PHP?

I am working with two MVC systems that need merged. It appears both use different session variables and different cookies. The main problem I have is trying to get each one to pass sessions variables back and forth, which it does not want to do. What is the best way to go about merging the two? Update: I am trying BlueImp chat with ano...

Smarty Templates - Return product info based on topic type

Im using the following code: {foreach from=$entries key=i item=topic} {if $topic.topic_style == problem} <li> <a href="topic.php?id={$topic.id}">{$topic.title}</a> </li> {/if} {/foreach} Which returns the topics which are all 'problem's. Its possible to tag a problem with a product, the system uses the Get Satisfact...

Project Thoughts: Searching Directory of PDFs

To preface this, I know there are discussions on this in various places. Half of what I read is outdated, buggy or simply unrelated to my situation. This is why I am bringing it to the community that I know will have the answers. Question: I have a directory (online is ideal) of around 70,000 pages in PDF documents (documents range fr...

PHP simpleXML: load string as node returns blank? (simplexml_load_string)

I'm trying to add a child to an XML-node by loading a string as an xml-node, but for some reason it returns an empty value ... // Load xml $path = 'path/to/file.xml'; $xml = simplexml_load_file($path); // Select node $fields = $xml->sections->fields; // Create new child node $nodestring = '<option> <label>A label</label> ...

Is it safe to store OAuth WRAP access tokens in a cookie?

I'm planning to setup a website that would access an oauth wrap framework. I was thinking of storing the access token on the client machine as it is. I do NOT want to maintain a database of temporary tokens, etc on the server. Should I be doing do? Or should I encrypt it? What else do I need to successfully manage a non-database utilizi...

Codeigniter form_dropdown issues

I need a bit of help. I have this in my view $salutation = array( 'Mr.' => 'Mr.', 'Mrs.' => 'Mrs.', 'Dr.' => 'Dr.', ); echo form_open('membership/update'); echo form_dropdown('Salutation', $salutation, 'Mrs.'); The dropdown works in all but one fashion, it does not pre-select 'Mrs.'. How ...

Parameterizing php code with DatePeriod, DateInterval classes

Hi, I dont understand DatePeriod, DateInterval classes very well. This question is linked to another one - http://stackoverflow.com/questions/3386952/how-to-display-converted-time-zones-in-a-generic-week-sunday-thru-saturday wherein I want to parameterize the solution offered by artefacto. Help would be appreciated! This is artefacto'...

Manipulating maps.

Given a set of floorplans (in Autocad, svg, or whatever format need be...), I would like to programatically generate directions from point A to point B. Basically I would like to say: "How do I get from room 101 to room 143?" (or for triple bonus points, from room 101 to room 323). Anyone have any ideas how to go about this? I am pre...

WordPress Plugin Question

Hi all, Is it possible to use plugins on my blog for WordPress.com? There are some very nice tutorials on how to do this if I have WordPress installed on my own server, but I am using wordpress.com. Does anyone know if they allow this? It seems like the expected "Plugin" category on my dashboard is missing. Many thanks, brett ...

Choose & read file in PHP

Hi, In a form in PHP, I have a textarea and a Choose File option. The code for Choose File is as below <input name="upload_file" type="file" id="Browse" title="Browse" value="Browse" /> What I have to do is Choose a file and display its contents in the textarea, as soon as I select the file (No click event to happen). How can I go a...

Smarty dealing with array

Im trying to view contents of array on the page: {foreach from=$entries key=i item=topic} {if $topic.topic_style == question} <li class="mail"> <a href="topic.php?id={$topic.id}">{$topic.title} </a> {$topic.tags} </li> {/if} {/foreach} $topic.tags is a...

frameset htaccess index.php url routing

hello, My question ist about htaccess redirecting everything to bootstrap.php. My index.php is just pure html about a frameset (i know frames are uncool, but I must). So I redirected everything in the htaccess to bootstrap.php and now am trying to build a URL-Router. But somehow, it does not work. When i request an URL like f.e. http:/...

Is it safe to have 1 letter class names in PHP, e.g A, B, C

Is it safe to have single letter class names like A, B, P, etc? ...

php - find if an array contains an element

I have an array with just a list of ids, like so: $my_array = array( 12, 17, 99, 23 ); Now I know I could probably do something like: function in_array($haystack = array(), $needle = NULL) { foreach($haystack as $id) { if ($id == $needle) {return TRUE;} else {return FALSE;} } } but it seems like there's probably already...

php page can't load MySQL's database

Hi I'm having some problems while trying to connect a .php with mysql. here's the connection.php code <?php $db_host =$_POST['localhost']; $db_user =$_POST['root']; $db_password = ""; $db_name = "prtcl"; ?> and this is the page where I actually use the connection <? include("connection.php"); ?> ... <?php $db = mysql_connect($db_...

How to send the dyanmically generated <tr> to the next page

I am implementing a shopping cart site. When the user add the item, it will automatically add to cart with the product name and the price as a div. the code is below <div class="food_menu_add"><a href="#" id="ad"><img src="images/add.gif" onclick="addcart('Sliced Orange')" /></a></div> <table id="placehold"> </table> function addcart(n...

PHP time substraction

I am trying to substract 24 hours time format and then convert it into minutes but it does not work well. Here is my code $time1 = '2010-08-05 23:00:00'; $time2 = '2010-08-05 00:00:00'; echo round( (strtotime($time2) - strtotime($time1)) / 60); it will display this -1380. if you put 1-23 hour in time2 it will work. I tried to conve...

wordpress test site goes to main site url...how to solve?

For example I have a live WP site http://wpsite.com I wanted to make a live mirror copy of http://wpsite.com at http://wpsite.com/test/ so i copied all data of public_html/ folder to public_html/test/ then i checked http://wpsite.com/test/ but everything is going to http://wpsite.com/ is there any .htaccess problem? This is .htacces...