This is what i want to do:
I want /summary.php to include 5 latest posts (only the extract) from my blog, which lives in /wp.
Is there any way to include Wordpress in /summary.php and only print the html for these posts? (Maybe i should parse the rss?)
...
I have a database the I am rebuilding the table structure was crap so I'm porting some of the data from one table to another. This data appears to have been copy-pasted from MSO product so as I'm getting the data I clean it up with htmlpurifier and some str_replace in php. Here is the clean function:
function clean_html($html) {
...
I work in a company where OOP is... well, not fobidden, but at least frowned upon as "too complex". My coworkers write lots of 100+ lines functions and they are usually all in a "funcs.inc.php" or "something.inc.php", if they use any functions at all, often they don't since copy-paste is faster.
I would love to start using TDD at least ...
I came up with this:
if($prog->memcache) {
$r = $prog->memcache->get("ratelimit:{$_SERVER['REMOTE_ADDR']}");
if(!empty($r)) $prog->errorClose('This IP has been flagged for potential abuse.');
}
foo(); // the thing we're rate limiting...
if($prog->memcache)
$prog->memcache->set("ratelimit:{$_SERVER['REMOTE_ADDR']}", 1, 0, ...
Do you know is there any function in PHP to make the first character of the word uppercase?
Or must I write it by regular expression?
...
I have a comma delimited list of ids that I want to use to retrieve records from the database. I can use the IN statement to get the results but I want the order of the results to be the same order as the original list.
EG
$list = "3,1,4,2,5";
$query = "SELECT * FROM table WHERE id IN (" . $list . ")";
$result = @mysql_query($query);
...
i have some text in foreign language in my page,
but when i make it lowercase, it starts to look like this...
$a = "Երկիր Ավելացնել"
echo $b = strtolower($a);
//returns ����� ���������
i've set <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
could you tell me why?
thanks in advance
...
Hi there,
I've had this problem bending my mind for a while now (head cold doesn't help either!), basically I have a PHP array which looks like this example:
$array[0][0] = 'apples';
$array[0][1] = 'pears';
$array[0][2] = 'oranges';
$array[1][0] = 'steve';
$array[1][1] = 'bob';
And I would like to be able to produce from this a tabl...
Probably a trivial question, but in which order does Exception::getTrace return calls? Most recent first or last? I'd like to know before I implement my error handler.
BenTheDesigner
...
I've been building a site in PHP, HTML, CSS, and using a healthy dose of jQuery javascript. The site looks absolutely fine on my Mac browsers, but for some reason, when my client uses PC Safari, she's seeing strange bits of my HTML show up on the page.
Here are some (small) screenshot examples:
Figure 1: This one is just a closing <...
I have something like this in one of my views
<li <?php $isCurrent ? echo 'class="current"' : ''?> >
<a href="SOME_LINK" class="SOME_CLASS">SOME_TEXT</a>
</li>
This causes a syntax error, unexpected T_ECHO. Changing echo for print solves the issue, but I would like to understand why I cannot use echo.
...
I use __autoload to load classes, and I keep getting errors that no class is found but file get's loaded ok.
Then if I change something in a file, just something like add a new line and save it, everything works fine and class is then found.
But this is a great problem cause there are thousands of files in this project and I don't want ...
I was reading the manual about basic placeholder usage, and it has this example:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
// ...
protected function _initSidebar()
{
$this->bootstrap('View');
$view = $this->getResource('View');
$view->placeholder('sidebar')
// "pref...
Hi! I am creating site with php.
On localhost all works well.
On my hosting all looks good too, but on top of page i see "?>". In my code these symbols are absent.
What is this?
...
I am using this code in wordpress to display different content when different pages are loaded. I have 5 pages on the site called Home, Bio, Work, Contact and Notes. The Notes page is being used as a blog. Here is the code I am using.
<?php if (is_page('contact')) { ?>
get in touch with me
...
<?php
$system = $_POST['system']; // The FreshBooks system
$name = $_POST['name']; // The name of the event that just happened, e.g.invoice.create
$id = $_POST['object_id'];
$subject = "[$system] Event: $name";
if ($name=='callback.verify') {
$body = "
$name just happened on $system
Verification token: ".$_POST['verifier']."
";
} el...
Is there a way to format an tag to send a query, pull all Sticky Posts, and loop through them?
Since 'sticky' is not a category, I cant format the link in the normal :
http://mysite.com/category/cars
I'm thinking is probably going to have to be some kind of url query string sent in as GET.
...
I'm kind of confused.
I would put all the HTML for the menu in a .php file and have the engine require it right?
...
I am trying to learn PHP classes so I can begin coding more OOP projects. To help me learn I am building a class that uses the Rapidshare API. Here's my class:
<?php
class RS
{
public $baseUrl = 'http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=';
function apiCall($params)
{
echo $baseUrl;
}
}
?>
$params will...
For example, to access a page in my search folder, I have to write:
mywebsite.tld/search/searchJob.php
I don't want users to have to write down folder structure and whatnot. What can I do to change this?
OR, is there a better way to organize my files? Because I'm only two pages in and I decided to move some files and got lost in the h...