Is this bad practice to use php statements such as 'if' within a jquery function?
should I really just be writing loads more functions instead of limiting a few using php? it seems to work fine but was wondering if this is a major faux pax?
example:
this is a code snippet, basically if the php variable $url is equal to 'projects' then...
$value = '\\40';
file_put_contents('o.txt',$value);
file_put_contents('o2.txt',var_export($value,true));
D:\test>php str.php
D:\test>cat o.txt
\40
D:\test>cat o2.txt
'\\40'
...
When I perform a foreach loop over an associatve array in php, the order in which it is performed is the order in which it is defined.
For example:
$arr = array("z" => "z", "a" => "a", "b" => "b");
foreach($arr as $key => val)
print("$key: $val\n");
Outputs:
z: z
a: a
b: b
Whereas
$arr = array("a" => "a", "b" => "b", "z" => "z...
Have the following cronjob set up in root's crontab: (centos 5.x)
2 * * * * /usr/bin/curl --basic --user 'user:pass' http://localhost/cron/do_some_action > /var/www/app/cronlog.log
Invoking the actual command works as expected, however when the cronjob runs, it always times out. I've used set_time_limit() and related php.ini settings ...
Hi can someone help me identify if a url is present in a string using PHP?
I want to pull in a full string i.e. "Hi please visit http://domain.com/12345 today" and strip out the full url not just the domain name.
Thanks
...
I have a bunch of HTML that is generated by a daemon using C, XML and XSL. Then I have a PHP script which picks up the HTML markup and displays it on the screen
I have a huge swathe of XHTML 1 compliant markup. I need to modify all of the links in the markup to remove &utm_source=report&utm_medium=email&utm_campaign=report.
...
hi all,
i all the years i have been developing in php, i've always heard that using eval() is evil.
considering the following code, wouldn't it make sense, to use the second (and elegant) option? if no, why?
// $type is the result of an SQL statement
// e.g. SHOW COLUMNS FROM a_table LIKE 'a_column';
// hence you can be pretty sure ab...
Hi.
I want to generate a list (dropdown) with habtm relationship, for example i have a table called "users" another called "vehicles" and "users_vehicles".
What i want is to get vehicles assigned to "x" user and put it in a dropdown, how i can achieve this?
class User extends AppModel {
var $hasAndBelongsToMany = array('Vehicle'...
Hi guys, im in the beginning of the complete restyle of an my web application, and i have some doubt about a good database-design that can be reliable, query-performance, and in the same time fully customizable by the users (users wont customize the database structure, but the funcionality of the application).
So, my actual situation is...
Is there an Elmah equivalent for PHP in general, Symfony in particular?
...
I would like to group multiple queries into a single function that lives in PostgreSQL. The function will be queried using PDO.
The function is:
CREATE OR REPLACE FUNCTION "test_multipe_refcursor"()
RETURNS SETOF refcursor AS $BODY$
DECLARE
parentRC refcursor;
childRC refcursor;
BEGIN
open parentRC FOR
SELECT * FROM parent;...
I am trying to write this, query with zf select but without success
SELECT * FROM `subscribers` WHERE id IN (Select subscriber_id From gs_relations Where group_id=55)
I was trying with ssomething like this:
$gs_relations = new GSRelations();
$part = gs_relations->select()->from('gs_relations',subscriber_id')->where("group_id=$group_i...
I have XDebug enabled on my XAMPP installation. I've used XDebug + Wincachegrind to profile my code for some time. Recently XDebug started throwing some weird stuff into cachegrind.out files.
Examples of weird stuff:
fl=fl=php:internal
fn=php::ini_set
127 7
and
fl=C:\xampp\htdocs\drupal-5.7\includes\session.inc
fn=sess_close
0 3
=1...
I need to get data from a web site written in PHP. My boss wants me to provide an RSS feed to get updated content.
The problem is that I need to provide several informations (at least a dozen different field). Is returning data as XML a better way than RSS?
...
I have a transparent PNG image. The transparent areas need to remain completely transparent, but the other areas need tinting with a particular hue.
What's the best way to do this using GD?
Cheers,
James
...
I have been coding my PHP applications in Notepad. I want to take it a step up and do it professional, and as far as I can tell using the Zend Framework is where to start. I have been reading the documentation and quick start and a few tutorials but I am still completely lost.
Is Zend on your local machine or on the remote server?
Is ...
Working Example:
This is almost identical to code I use in another places on my page but fails here for some reason.
<?php
//$p = "test";
?>
<script>
alert('posts are firing? ');
parent.document.getElementById('posts').innerHTML = "test";
</script>
Failing example: (alert still works)
<?php
$p = "test of the var";
?>
<script>
aler...
I'm trying to put some folders on my hard-drive into an array.
For instance, vacation pictures.
Let's say we have this structure:
Set 1
Item 1 of Set 1
Item 2 of Set 1
Item ... of Set 1
Set 2
Subset 1 of Set 2
Item 1 of Subset 1 of Set 2
Item ... of Subset 1 of Set 2
Subset 2 of Set 2
Random file, not a dir.
Set 3
...
I want t...
I've spent all morning trying to find an answer to this, to no avail. I'm working on a website, and I set up a small test server to make changes on. When I loaded the page I had made a few changes to, I noticed that the page stopped short. I reloaded the page, and it stopped at a different place. I reloaded again and again, and noticed t...
Hi,
I'm including a local class that requests a file from a remote server. This process however, is rather unreliable (in the sense that the remote server is often overloaded), and I would have to wait a few seconds (about 20 or so) before the include gives up and continues.
Now, I would like to have a time limit on the execution time o...