I have a User class which is created when a user logs in
$user = new User($userId);
Now to check if a user is logged in, I tried doing
if (isset($user)) { // user is logged in
} else { // user is not logged in
}
However, isset() doesn't appear to work for objects? And I've also tried is_object(). Please advise! Hopefully the...
I'm trying to put an image as a separator between menu items but not on the outside and I'm not sure how to do this.. So it would end up being something like this:
HOME | ABOUT | CONTACT
unfortunately my code puts one after every entry including the last one.
mysql_select_db($database_db_connection, $db_connection);
$query_rsMenu = "S...
I have a page with a list of articles of a given category, what I'm trying to do is to give the possibility to "answer" an article ("comment" if you prefer) but this answer needs to be a text + attached doc.
My question is :
What Plugin/component/solution comes to your mind?
I'm trying to figure out if there's any existing plugin th...
I am currently working on a light php framework to use with some high request ajax for my site, and have run into an interesting problem that has me completely stumped. The ajax is for a series of notifications, so the javascript sends off an ajax request for new information every 30 seconds. This ajax is active on every page of the enti...
I'm trying to make a simple site that uses php and the Twitter API to write out my latest post from twitter. I found a tutorial showing me how to get my timeline (or last 20 posts) in xml format, but can't figure out how to print out just the latest post, and just the text of it (not the time, date, etc that come with the xml/rss/etc).
...
I am personally a very big fan of following internal coding standards when working with a group of developers. I feel like it brings continuity to the code and allows people to more easily expand the code base, switch off work, and assist each other with difficult tasks.
On the other hand I am aware that a large set of people are of the...
Hello ...
There are number '2352362361 ', as it is separated by spaces from the end of 3 characters?
The output should obtain '2 352 362 361 '
...
I want to be able to open a PowerPoint file with PHP and copy all the text to a different file.
Is this possible or I need another language to do this?
...
I am adding some additional logic to page.php in a wordpress theme.
This theme already has 4 sidebar widgets (north, south, east, west).
I need to get the text that is entered into a text widget from the wp-admin widget panel within my page.php code. This logic is "outside the wordpress loop".
...
I need to list all PHP extensions that's required by a given code base.
What would be the best way to tackle this problem?
My initial thought is to write a script that goes through all files and find all functions and compare them to a given extension/function database. Any other suggestions?
Update: I already did some Bash script w...
Is there a way to make it so when a site is viewed with a phone or other small mobile device the site automatically recognizes that it is being viewed as such and either re-directs to a phone friendly subdomain mirror or automatically calls a script that makes it phone friendly?
Any articles or advice would be greatly appreciated!
...
Hi!
My MySQL Database Provides A List of Items (and integer IDs with them) in a <select> and a qty field for usage on my web form (with style display: none so it is hidden). But: I want the user to be able to select how many choices of this type he wants to enter in the form - how can I dynamically make multiple selects?
Example: The p...
Hello, I am trying to make my pagination script a bit more dynamic and am needing some help with the calculating of the page numbers part.
I have this script below which calculates the number of pages using php, however I would like to add other buttons that when clicked will filter and sort out data which means the pagination numbers n...
Hi
I am using the following code to match all variables in a script starting with '$', however i would like the results to not contain duplicates, ie be distinct/unique:
preg_match_all('/\$[a-zA-Z0-9]+/', $code, $variables);
Any advice?
...
$subject = "SPRINT-1.csv";
$pattern = '/^[a-zA-Z]\-[0-9]\.(csv)+$/';
if(preg_match($pattern, $subject)) {
echo "Match";
} else {
echo "NOPE";
}
or
$subject = "SPRINT-1.csv";
$pattern = '/^\w\-\.(csv)+$/';
if(preg_match($pattern, $subject)) {
echo "Match";
} else {
echo "NOPE";
}
...
Is there a way to get the comments from buzz right now? I understand that the API is not fully out but i was wondering if anyone found a way to get comments from buzz.
Please notice that i am talking about comments and (NOT) status messages.
(Example, i publish something on buzz, 10 people comment on it, i don't want to get the buzz st...
I'm trying to write a few lines of code to make a case insensitive array unique type function. Here's what I have so far:
foreach ($topics as $value) {
$lvalue = strtolower($value);
$uvalue = strtolower($value);
if (in_array($value, $topics) == FALSE || in_array($lvalue, $topics) == FALSE || in_array($uvalue, $topics) == FA...
Hi everyone, I can't work out how to get the contents of the second span 'cantfindme' using php simple html dom parser(http://simplehtmldom.sourceforge.net/manual.htm). Using the code below I can get the contents of the first span 'dontneedme'. I cant seem to get anything from second span at all.
$html = str_get_html('<html><body><tab...
I used a class that converts errors to exceptions in PHP 5 and it logs the errors to a file and/or emails them to a specified account. Is there a better way to do this? There is something about this I know can be better. I am using set_error_handler.
set_error_handler("exception_error_handler");
My code does what it should in that it ...
I am using Zend_Auth to validate user credentials and ran into an issue. I need to have a dual column identity. The the two columns are user name and customer identifier. The identityColumn setting and setIdentity() methods don't allow for this scenario. I tried to accomplish this by using the credentialTreatment setting, but when I ...