I have a class which I want it's instances to be used only by a certain other classes.
Is there a known design pattern for such a problem?
An example for such a necessity would be a case of a big application (a team of 10) with BL objects and DL objects under a MVC hood, where I want to make sure only the BL classes can call/use the DL c...
here it goes;
echo "<a href='#' class='thumb'><img class='thumb-img' value = ".$row->aid." onclick='getVote(".$row->aid.", \"".$row->atitle."\")' src='images/roadies/th".$row->aid.".jpg' /> </a>";
the above function sends the "$row->aid" value to a javascript function through ajax.
in the javascript however, i want to make a function...
Does anybody know why could cURL under php5 be so damn slow to fail even at 45s timeout, downloading a few kb file on a speedO'light server?
The code is here as requested (although I upped the timeouts even more for the script not to fail during execution and changed useragent to Mozilla/4.0 from initial Chrome):
$ch = curl_init('http:...
I have a table that looks like this:
(so you can picture it visually)
13 22 12
10 8 12
html:
<table>
<tr>
<td>13</td>
<td>22</td>
<td>12</td>
<tr>
<td>10</td>
<td>8</td>
<td>12</td>
</tr>
</table>
it's being populated by mysql rows:
<?php
$i = 1;
$id = mysql_fetch_assoc(mysql...
NetBeans is recommending to use MAMP for Apache + MySQL + PHP on the Mac. There's a MAMP and a MAMP PRO. The MAMP is actually nothing more than a collection of open source libraries and stuff like PHP, MySQL, etc. in one big directory that goes to /Application/MAMP/. It comes with a little GUI to start/stop the server and to do some very...
At work we have a web app that we'll need to interface with another company's web app using Single Sign On validated by SAML. Our web apps are written in PHP, and it's obviously irrelevant what language choice the other company is using. Nonetheless, I've needed to write a simple API that this other company can send SOAP requests to with...
i have 2 questions to ask:
first of all, in while ($row = mysql_fetch_object($result))
i have an object: $row->atitle
now through javascript, i want to print on the page an ++increment of the current object of the array.
i am doing this:
hidephp = document.write("<?php echo .$row->atitle.["+inc+"];"+" ?>");
the above doesnt seem t...
I have a CDN that is storing media files. Each file I want to store as just the ID number of the file in the data so, file.zip = 4423342 on the server. The problem is, the CDN does not allow php or any form of programming. How can I make it so I have a local file that is used to set the headers and let me change it so when they download ...
I'm having trouble trying to figure out how to achieve this programming challenge in my Zend Framework application:
I need to create an array that looks like this:
$array = array(
0 => stdClass()->monthName
->monthResources = array()
1 => stdClass()->monthName
->monthResources = array()
);
...
On one project, I have an internal calculation of times.
The days since the launch are simply enumerated:
2009/10/19: launch day
2009/10/20: day 1
2009/10/21: day 2
etc.
Now I would like to have a function which gives me the current day of the internal calculation of times. E.g. "day 129" on one day in 2010.
But it is important to ha...
I am a PHP novice, so bear with me if any of my terminology is incorrect.
I have a small PHP file (page_class.php) that defines some functions and I include this file in the header.php of my theme:
<?php include("page_class.php"); ?>
And these are the contents of page_class.php:
<?php
function curPageURL() {
$pageURL = 'http';
if ...
I have been mis-interpreted. I have created a JSON Object in PHP. I just need access to that object in Javascript. thats all.
i just learned that many of my problems can be solved by using JSON. now how to use JSON is another problem, though ;-)
suppose this is the code in PHP:
$row = array()
while ($row = mysql_fetch_object($result)
...
Hi all,
Im trying to figure out how to handle this is no results are returned, how would I code that?
while($row = mysql_fetch_array($Result))
So like if there a results: print them out
else: show a link
...
Hi, I am trying to customise a Wordpress theme. I have a function in themes/functions.php that I would like to run on some pages.
I need to be to:
Detect the page ID to determine whether the function should execute
Determine which hook to attach the function to (preferably something like page load.
Cheers
...
Something, I think Apache, adds these HTTP headers to all responses generated by PHP scripts:
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
This works ok for actual dynamic pages, but I have some page that, while generated by PHP, are mostly static, and I want th...
Background: I need to setup a search engine for my classifieds site, which is PHP and Mysql based.
I have downloaded Zend Framework and have no clue what to do with it.
My webhosting provider says they don't support changing the php.ini file, and all tutorials I have found so far is based on changing that file.
I have found very little...
I need to parse a html definition list like the following:
<dl>
<dt>stuff</dt>
<dd>junk</dd>
<dd>things</dd>
<dd>whatnot</dd>
<dt>colors</dt>
<dd>red</dd>
<dd>green</dd>
<dd>blue</dd>
</dl>
So that I can end up with an associative array like this:
[definition list] =>
[stuff...
Hello,
I am having an add/edit form to update and add to database, and I was not sure what the best way is to input TIME type (HH:MM:SS). Should I use multiple html text inputs for HH, MM, SS?
if so, is there a function that prepares the string for database input?
Basically what I'm trying to input is how many hours, minutes, seconds a...
the current xmlhttp function i am using is passing a very tiny int to the php file for processing using the GET method.
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="user_submit.php";
url=url+"?vote="+value;
url=url+"&sid="+M...
I have a $data at a column1 shows me:
"AAA123"
"ABC1234"
"ABD123"
"BAC12"
"CAB123"
"DA125"
and so on..
I would like to show $data starting with only "AB" which shows me at column1 like :
"ABC1234"
"ABD123"
not the others but also other rows and columns related to "ABC1234" and "ABD123"
Thanx in advance.
...