I'm trying to parse a view with BBCode, and it works fine. But there is one feature I don't know how to implement.
[box=test] should be replaced with $this->load->view('admin/news/test', '', true);
This is my code so far:
$CI =& get_instance();
$view = preg_replace("'\[box=(.*?)\]'i", "\\1", $str);
The thing here is that \1 will be...
Finally gave up on my own pretty-quotes function to use SmartyPants-PHP's one-stop SmartyPants() ... except it seems that it doesn't do pretty curly-quotes (just straight quotes) for strings submitted from post forms or get url's.
Tested curly quotes to show with SmartyPants on a string defined in the same doc. Replace that string with ...
So i have the line in the http.conf that relates to PHP uncommented out and i have mysql installed but where is my php.ini file located for me to point to mysql.sock.
...
I have the following setup:
<?php
class core {
static $var1;
}
class parent extends core {
function getStatic() {
return parent::$var1;
}
}
class child extends parent {
function getStatic() {
// I want to access core static var, how can i do it?
//return parent::$var1;
}
}
?>
I need to be able...
A little new to PHP parsing here, but I can't seem to get PHP's DomDocument to return what is clearly an identifiable node. The HTML loaded will come from the 'net so can't necessarily guarantee XML compliance, but I try the following:
<?php
header("Content-Type: text/plain");
$html = '<html><body>Hello <b id="bid">World</b>.</body></...
I've tried addslashes, mysql_escape_string, and mysql_real-escape_string. None of them are working and I'm not sure what else to try
...
What's the best way to get PHP to convert regular quotes to pretty quotes.
i.e., convert -
straight quotes:
Poe's Great Aunt Sally said Poe said, "Once upon a midday dreary."
converted to curly "pretty quotes":
Poe’s Great Aunt Sally said Poe said, “Once upon a midday dreary.”
...
Hello!
Code inside Function is working, but as i want to process more then one Url i wanted to make it a function using a array to get the urls to process. Here is the Code:
<?php
$site = array("http://www.ihr-apotheker.de/cs1.html", "http://www.ihr-apotheker.de/cs2.html", "http://www.ihr-apotheker.de/cs3.html");
fu...
Hello SO,
I'm working on a job board in Codeigniter PHP + jQuery where employers enter their location and we use Google Maps API to plot it. While this has had awesome usability results, the problem is when we try to display these locations to job seekers they are muddled and hard to visually discern (they read like this: "02905, 2 mil...
hello -
I want to know if there is a option in php or .net to say from which ip address we can send out email.
We have couple ip addresses on one of our servers and we don't want to send the emails from the default ip, instead we want to send them from the other ip.
Thanks in advance.
...
When using dependency injection for database handlers etc instead of singleton - where is it best to keep the configs I.e. Username password host etc. Keep inside the class, use a container class or use a static configs class or use a file?
...
I'm trying to find the best method to upload images onto a server. I'm already using a script but it's not very secure. I'm not looking for anything using ajax, just a normal php upload but very secure. I Googled some scripts but there are too many, I'm not sure how to tell which is the best.
Can someone who dealt with image uploads bef...
I just got a strange problem. I am including some files from my index.php, and now I got this error:
require(cfg/cfg.database.inc.php) [function.require]: failed to open stream: No such file or directory in C:\...\index.php on line XX
Strange is that it worked just a minute ago. I double checked the spelling of that filename.
What ...
Hi,
I have Matrix and how get value from there?
The data obtained from a file, so that the matrix can be of different sizes
Thanks
...
I'm writing a user input library to easily manage the dynamic creation of forms for asking users for data.
I wanted to make the end developer have to 'think' about the bare minimum, so I went with having them throw exceptions instead of returning 'true' or 'false' and remembering to handle the return value etc.
In reality, it's worked ...
Hello,
I need a replace string once function and believe preg_match might be my best bet.
I was using this, but due to the dynamicness of use, sometimes this function behaves strangely:
function str_replace_once($remove , $replace , $string)
{
$pos = strpos($string, $remove);
if ($pos === false)
{
// Nothing found
...
I'm adding new content to a node, but I'm stuck on what to put in #type. I know that when you're dealing with a profile page for example, you would put
'#type' => 'user_profile_item'
but what to put for new content on a node?
$node->content['newc'] = array(
'#type' => , //what to put here for type
'#title' =>...
I'm having a memory leak problem wrapping a C++ library in PHP using SWIG. It seems to happen when callbacks from C++ containing complex types are sent to PHP while directors are enabled. Here is a standalone example to reproduce the leak:
Client.hpp:
#ifndef CLIENT_HPP_
#define CLIENT_HPP_
#include <vector>
#include "ProcedureCallbac...
Hey there, why does this code not work?
$qry = mysql_query("SELECT performerid,pic0 FROM ".$table." ORDER BY RAND() LIMIT 6");
$start = new WP_Query('showposts=6&orderby=rand');
if ($start->have_posts()) : while( $start->have_posts() ) : $start->the_post();
$rows = mysql_fetch_assoc($qry);
if (!$row...
Hope this doesn't get too complicated. :) thing is..
I'm trying to make my PHP code post notes to Google Buzz using OAuth as authentication mechanism. I'm doing the typical "OAuth dance" (get request token, authorise it, exchange for access token), but i've ran into some problems that seem to be on Google's side. Hope i'm wrong - it wou...