php

Displaying a links absolute location...

Is there any way I can display a links location absolutely when I only reference it relatively. I.e. A file is relatively referenced like... <a href='../../files/uploaded_file.jpg'>Your Uploaded File</a> But I would also like to display some text saying... You can link to your file via www.example.com/files/uploaded_file.jpg The c...

How to protect our code?

I have to protect my code? which is the best method for protecting our codes? any body can help me? ...

Get the right path to the file

I store user images in "images" forlder and the full path is something like this: http://example.com/images/imagename.jpg When I try to get the image path like this: $path = 'images/imagename.jpg'; it works fine on home page, but since I have different permalink structure it doesn't work on other pages. It becames something like...

Problem getting FB JS SDK to work on FB canvas app.

Hello, I am migrating my Facebook canvas application to using the new PHP SDK. However, I am having a problem getting the JavaScript SDK to work too. I'm wanting to take advantage of methods such as stream.publish in the JavaScript SDK. Unfortunately I've not been able to get anything to work thus far. I have the following in the heade...

Does WordPress expose a base URL in its JavaScript by default?

Usually when building sites I add something like this var config = { basePath: '<?php echo BASE_PATH; ?>' } Simply so with my static JavaScript files I can do AJAX requests like var request = config.basePath + 'ajax/get-something'; Does WordPress have a similar variable available to its JavaScript files by default, assuming I a...

Add my own shipping methods in oscommerece

I want to add an own shipping method during checkout_shipping.php. Something like a dropdown list, from that the customer will select his shipping method and enter his own account no in a textbox. How should I implement this? ...

How many 'includes' is too many as part of a common script startup sequence? Or is there no such thing?

By "common script startup sequence", what I mean is that in the majority of pages on my site, the first order of business is to consult 3 specific files (via include()), which centrally define constants, certain functions used in many scripts, and a class or two, as well as providing the database credentials. I don't know if there's a mo...

Matching array keys

I have this array, Array ( [campaign_title] => adasdasdasddsad [campaign_keyword] => asdsadasdasdasdasd [introduction] => asdasdasdasdasdasdsa [campaign_headline] => Array ( [0] => asdasdasdasdasdasdad ) [article] => Array ( [0] => asdasdasdasdasdasdasdasdsadas ...

[Approach] Multilang catalog(with custom fields) DB structure design

Hi, Soon I'll be working on catalog(php+mysql) that will have multilang content support. And now I'm considering the best approach to design the database structure. At the moment I see 3 ways for multilang handling: 1) Having separate tables for each language specific data, i.e. schematicly it'll look like this: There will be one tab...

preg match not reading content between table

preg_match_all('|(.*?)|', $read, $foo, PREG_SET_ORDER); print_r($foo); output as just Array ( ) Where i made mistake See guys , Actually i want to grab the exact details from this URL i want to pick this details from this URL 08:35 9W5048 TORONTO EXPECTED 1358 Terminal three So i tried this snippet , but...

.htaccess Set PHP Value depending on Hostname

Hi, for our project we need to set several PHP values depending on the environment (development/production), most notably session save path and some tracing and profiling settings. We do not want to set them in the PHP script because due to some horrible legacy code which would require a lot of changes and we don't want to have to chang...

how can i access such a php array

i was trying to access this php array with no luck, i want to access the [icon] => icon.png Array ( [total] => 2 [total_grouped] => 2 [notifys] => Array ( [0] => Array ( [notifytype_id] => 12 [grouped] => 930 [icon] => icon.png [n_url] => wall_action.php?id=930 [desc] => 690706096 ...

Writing PHP into Javascript or Javascript Into PHP

i have this code var myChart = new FusionCharts("../themes/clean/charts/hbullet.swf", "myChartId", "400", "75", "0", "0"); myChart.setDataXML("<chart lowerLimit='0' upperLimit='100' caption='Revenue' subcaption='US $ (1,000s)' numberPrefix='$' numberSuffix='K' showValue='1'><colorRange><color minValue='0' maxValue='50' color='A6A...

Using models in CodeIgniter...

Can somebody explain to me when it's a good practice to use models in CI? An article in wikipedia was referring to CI models as "entirely optional and are rarely needed" is that true in any way?thanks in advance! ...

In PHP how do we set the expiry date of a session?

I'm new to sessions and PHP. I know how to set the expiration of a cookie. I wanted to know how is something similar done for a session. ...

retrieve subdomain as a get variable

Hi guys I'm setting up mywebapplication to give unique urls for users such as uniquename.mysite.com, anotheuniqname.mysite.com etc. I want to be able to in a php script grab the subdomain part of the url. Would be nice if I can get it as a GET variable - I think it can be done with htaccess. Any ideas? ...

PHP file structure for a simple website?

Hello there! I have been working with PHP for a couple of years now but I don't consider myself any more than a moderate programmer. While creating some websites (varying from presentation websites to some simple CMS'es), I have taken 2 approaches which I will discuss below. My question is simple: which one is better in terms of custom...

How to create a generate code section in our site ?

I have to give the Html code of my order form to third parties. Once they register and payed they can copy and paste the html code from my site to their own site. but the date will be saved in my site with the reference of the reseller. How can I implement this kind of a section in my website. any body can help me. I am using php5 and my...

Concatenating a second string to a row already containing a string

I have a PHP process running as a result of a JavaScript AJAX request, which is potentially running for some time and will produce data from time to time. From a usability perspective, I'd like to be able to return data to the JavaScript as soon as it's produced, but this appears not to be possible. My workaround is to write it to an SQ...

How to add a series of string in incrementing id in any table?

I have MySQL Table with an Order table in a DB this table has an auto-incremental id. Up-till now we have general numeric Order-ID likewise 1,2,3,4,5... From now onwards I have to append the series A20 to my id like A20103, A20104, A20105 and so on and when the last three digits reaches 999 the series appended should get changed to A2100...