I've been digging around for an ORM to use in a php/mysql application. However none quite grab my attention past "hello world" tests. So, I decided to do some research and try to code my own custom ORM. However I haven't been able to find resources that explain at code level how to handle db relationships. The concept of how an ORM works...
For example: a is not smaller than b
How do i write this ?
...
Hello! I'd like to encapsulate functionality specific to certain models by including methods in the model class definitions. So, for example:
abstract class BaseUser extends DoctrineRecord {
public function setTableDefinition(){
//etc.
}
public function setUp(){
//etc.
}
public functio...
I'm pulling my hair out trying to figure this one out. I can't get the Bootstrap to work properly when outside of the Drupal dir. It works fine if I run this code in the Drupal dir, but up one level doesn't work.
My Drupal path is /public_html/drupal/. The script I'm running is in /public_html.
$user is not returning the logged in use...
I need to send the following header with my httpRequest:
'X-ABC-Reco-Token'=>'a0d15977';
I have the following code:
$array = array("X-ABC-Reco-Token"=>$token);
$this->request->setHeaders($array);
echo var_dump($this->request->getHeaders());
however, this is the output I get:
"X-Abc-Reco-Token"=...
I am trying to debug a nasty utf-8 problem, and do not know where to start.
A page contains the word 'categorieën', wich should be categorieën. Clearly something is wrong with the UTF-8. This happens with all these multibite characters. I have scanned the gazillion topics here on UTF8, but they mostly cover the basics, not this situat...
Hello,
I hope you guys can help me with this one. So, I have a products table and a categories table. The structure for the categories table is listed bellow. There will be about 20 categories with three or four levels deep. In order to get the category tree a wrote a recursive function and it is working fine.
My new task is to displa...
I have a certain amount of characters that I can fit in the spot I want to display the category. So I was wondering if there was a way I could limit the ammount of characters that this function can output.
I want to limit this functions output:
<?php the_category(', ') ?>
outputs: WordPress, Computers, Blogging
Something like this:
...
When you define a function in a namespace,
namespace foo {
function bar() { echo "foo!\n"; }
class MyClass { }
}
you must specify the namespace when calling it from another (or global) namespace:
bar(); // call to undefined function \bar()
foo\bar(); // ok
With classes you can employ the "use" statement to eff...
I can do login realm in PHP and the way that I do it is by setting a session variable and check whether that session variable is set or not. On every restricted page, I check whether a certain session variable is set (or is equal to a certain value). If not, then i will send the user back to the login page. Is this the best way to do it?...
In short, what I want is a kind of export() function (but not export()), it creates new variables in symbol table and returns the number of created vars.
I'm trying to figure out if it is possible to declare a function
function foo($bar, $baz)
{
var_dump(func_get_args());
}
And after that pass an array so that each value of array...
I am wondering whether its possible to change/set/delete my session variable AS A USER.
I am re-thinking the way that I do login realm in PHP. The way that I do it now is that I check whether a certain session variable is set or not. However, this would break if someone can just change his/her session variable.
...
Hi,
Can php convert strings with all charset encodes to utf8?
Solutions that don't works:
utf8_encode($string) - but its only Encodes an ISO-8859-1 string to UTF-8?
iconv($incharset, $outcharset,$text) - but how can be find string current encodding?
(only can be if string part of html dom document, not just string)
thanks
...
What I want
Hi! I want to replace :) to smile.png and :)) to laugh.png.
The problem
The script finds :) inside :)) so laugh.png is not shown, only smile.png+)
This is what I have tried so far for :)):
preg_replace("/:)+(?!))/i",$image, $string))
Some other regexes what I tried:
"/\:\)+(?=\))/i"
"/\:+(?=\)\))/i"
But nothing...
I have recently added a comments section to a blog. Codeigniter says to always escape data before putting it into the Db.(I do have xss clean on fulltime). Some people say all active record operations are escaped. Am I wasting my time using escape on the function below?
Using the function below I escape the data, but it all comes out ...
Hi,
I have a simple HTML form which consists of radio buttons where user has to select 1 out of three. Now the Objective is to save the responses of the user, so we admin can view them later. I am more interested in their actual response rather than values field.
here is the sample code
<table border="0">
<tr><td><input type="hidden" ...
Need to xpath xml data based on greater than date attribute. The dashes in the date below prevent the greater than symbol from working. Is there a way to remove the dashes in the xml on the fly?
XML
<revisions>
<revision date="2010-07-12">blah</revision>
<revision date="2010-06-12">blah</revision>
</revisions>
PHP
$rdate = 2010-...
I'm using jQuery with PHP for form validation. I want to return the fields that do not validate so i can highlight them using javascript
this is my attempt using PHP(validate.php):
<?php
...
$a_invalidInput = array();
$from = $_POST['from'];
$to = $_POST['to'];
$email_to = $_POST['email_to'];
if( empty($from) ){
$a_invalidInput[] ...
hey guys,
not sure how i should name the title of the post.
i'm having a submitbutton on my page that's creating a folder for me. as soon as i press it. the site AUTOMATICALLY refreshes. There's no script set in my document that says the page should refresh. it just happens when i submit anything, right?
if (isset($_POST['createDir'])...
Hi,
I don't know the correct terminology to search for the solution. Please suggest a strategy to break up the php output into small chunks and pass them stepwise to ajax's responseText.
The project is an ajax webpage that takes a text string (lastname) and passes it to a php program. The php code takes the last name and randomly fet...