php

Archive Builder PHP

Before i start id like to say ive posted this question as more of a discussion rather than Problem Question. In my Database i have news posts lets say with 3 columns (Id, title, date). Wher Id and title are self Explanitory the date is stored in mktime() values, in other words the number of seconds passed since 1 January 1970. Now what...

Transitioning from an oldschool web framework to a more modern mvc based one?

At work we currently use a pretty outdated (php) "framework" that doesn't really make use of all the cool new stuff like spl autoloading, mvc, pretty much all the new stuff that came out for PHP in the last 2-3 years. I'm trying to transition this framework slowly into a more modern mvc based one but I don't want to jump the gun and com...

PHP - Is there a way to verify all values in an array

Using PHP.. Here is what I have.. I'm gonna explain the whole thing and maybe someone can help me with the logic and maybe point me in the right direction. I have a mail system I am working on. In the cc part, I am allowing the user to seperate the values by a semicolon, like so: 1;2;3;4... When these values are passed to my function,...

My custom Wordpress plugin is ignoring the <!--more--> tag

Hi, I am trying to figure out I can only execute my plugin on the single post page rather than the main index page. It is ignoring the tag which I thought would resolve this issue. Currently, this is how it is working: add_action('the_content', 'my_plugin'); I tried detecting the but it would return false all time. I thought it...

Multiple instances of TinyMCE in different forms with same name (jQuery).

I'm trying to implement an autosave feature that submits several different forms on a page with the same name with TinyMCE'd textareas. My code: function autoSaveEditForms() { $("#auto_save_notify").html("Saving..."); $("#auto_save_notify").show(); $("form[name=editForm]").each(function() { if($('input[name="question"]', this).val(...

encoding error in php and google translate

i have a text "Translate text, webpage, or document " which i need to translate into Japanese , the google translator return the string as 翻訳テキスト、 Webページ、またはドキュメント and when am writing that a text file the (ja.po) it looks like –|–óƒeƒLƒXƒgA Webƒy[ƒWA‚Ü‚½‚̓hƒLƒ…ƒƒ“ƒg what would be the error? i am using poeditor.exe to view...

Real world guide on using and/or setting up REST web services?

I've only used XML RPC and I haven't really delved into SOAP but I'm trying to find a good comprehensive guide, with real world examples or even a walkthrough of some minimal REST application. I'm most comfortable with Python/PHP. ...

CakePHP: Accessing database.php values

I need to retrieve values from CakePHP's config file database.php from one of my controllers. I'm maintaining an ex-employee's code, so I'm not positive how much of this adheres to default structures. I'm hoping this is fairly straightforward, but I can't seem to Google the right info. File: app/config/database.php class DATABASE_CONF...

jquery's ajax not working in facebook apps

Hi, I am trying to create a facebook application, all is working fine except the ajax part that I am using to populate a second box from the item selected in first select box. I am using jquery (v1.3.2) for accomplishing this. This ajax is working absolutely fine on the host where I have taken space for it, but it is not working in fac...

Using mysqli error numbers

I am building an object oriented wrapper for sql using mysqli - thats neither here nor there. I'm trying to use error numbers to detect if a database/table/column doesn't exist. Things would all be fine and dandy if I didn't receive error number 656434540.... Of course the error message is "bo.boo' doesn't exist". Its SUPPOSED to read "T...

Zend_Pdf Add text link to pdf page

Is it possible to add anchor text(link) in Zend_PDF page? I wasn't be able to find any information about this in Zend_Pdf online manual, or reading code, so I guess it is not possible. If there is way, please suggest! Thanks! ...

Common programming mistakes for PHP developers to avoid?

In the spirit of Common programming mistakes for .NET developers to avoid?, what are common mistakes PHP developers make? Using == when === should be used is a common one. What are some others (preferably from your own experience)? Community wiki'ed for complete satisfaction. ...

Suggestions for Tech to use for Blog/Organiser/Gallery App Ideas

i got some ideas for a blog/folio but i dont want to get a paid web server yet (still studying not really earning yet), and i thought of working on some ideas i thought will ease my blogging workflow. let me know if i can don't re-invent the wheel too much. or ideas on what i shld use overall i think i will use adobe air + flex + db (i ...

Why am I getting empty results in my RegExp?

I am trying to parse my URL into different parts using this RegExp: ([\w\\.-]*) Given an example URL http://www.foo.com/bar/baz I get those results from preg_match_all(): Array ( [0] => Array ( [0] => http [1] => [2] => [3] => [4] => www.foo.com [5] => [6] => bar ...

stripping character from mysql result

I want to move some char eg.(/,\,/t..etc) from mysql result. Can I strip every char with one function? I want to know this function.Help me! ...

Rating System in PHP and MySQL

If we look at the stackoverflow website we have votes. But the question is what is the bestway to store who has voted and who has not. Lets also simplify this even more and say that we can only vote Up, and we can only Remove the Up vote. I was thinking having the table to be in such form question - Id(INT) | userId(INT) | title(TEX...

PHP HTTP_REFERRER - how to detect last page?

Hiya, I need to detect where the user has just clicked from - as my AJAX content needs to be displayed differently depending on the source page it is to be inserted into. If it's to go into about.php it needs to be data only, but if it's to go into about-main.php it needs to be the whole middle column so needs a header/footer wrapper...

PHP is_json function?

Does anyone know of a robust, (and bullet proof) is_JSON function snippet for PHP? I (obviously) have a situation where I need to know if a string is JSON or not. Hmm, perhaps run it through a JSONLint, but that seems a bit overkill. ...

mb_convert_encoding for russian in php

how to convert Russian character to utf-8 in PHP using mb_convert_encoding or any other method? ...

What is the easiest way to convert existing PHP web application to mobile application?

Suppose I have developed one web portal in PHP/MySQL. I want to make it work in mobile also. What is the easiest way to do this? Can we use PHP with any mobile based mark up languages like WML or XHTML i.e. as we can use PHP with HTML in web applications used to view in normal web browsers? ...