php-general Digest 12 Apr 2013 06:28:27 -0000 Issue 8192
Topics (messages 320829 through 320835):
Re: Is BBCode Installed
320829 by: David Harkness
320834 by: Stephen
320835 by: shiplu
Re: how to insert html code with PHP
320830 by: Rafnews
320833 by: tamouse mailing lists
search array
320831 by: Russell Brackett
320832 by: tamouse mailing lists
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hi Stephen,
I just tried installing the PECL extension, but it failed to build on PHP
5.4.6-1ubuntu1.2. I see Xdebug in the phpinfo output, and I assume other
PECL extensions will show up there once installed.
Good luck!
David
--- End Message ---
--- Begin Message ---
On 13-04-10 10:05 PM, Stephen wrote:
I ran phpinfo() on my host and searched for "BBCode". Not found.
Does this mean that the extension is not installed?
If not, how can I tell?
Thanks
I am quite impressed with my host, hostpapa.ca
I put in a ticket, and in 8 hours then enabled bbcode for my account!
And I am on a shared server.
When enabled, it does show up on phpinfo()
Now I have to install on my home development machine!
--
Stephen
--- End Message ---
--- Begin Message ---
On Fri, Apr 12, 2013 at 4:24 AM, Stephen <stephe...@rogers.com> wrote:
> Now I have to install on my home development machine!
You can install it by following command
pecl install bbcode
Note: root privilege is necessary to install
--
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---
On 11.04.2013 19:19, Jim Giner wrote:
On 4/11/2013 10:48 AM, Rafnews wrote:
On 11.04.2013 13:34, Rafnews wrote:
Hi,
I would like to insert a piece of HTML code inside several pages.
all pages are differently named.
i need in each page to find a particular tag, let's say <div
id="#submenu">...</div> (so based on its ID and tagname) and inside it
to insert my PHP/HTML code.
how can i do that ?
thx.
A.
Ok i can write an include_once('myfile.php');
however if i have an array in this file, other files where is the
include_once(); do not recognize the array.
here is an extract of this file to include (submenu.php):
<?php
$submenu = array();
$submenu[] = array('id' => 1,'class'=>'menuitem1');
$submenu[] = array('id' => 2,'class'=>'menuitem2');
// function in the same file
function DisplayMenu($title){
// here i do not have access to the previous array $submenu define
outside the function
...
}
as it is included the function DisplayMenu should also have access to
$submenu array, no ?
basic php question. Variables within any function are local to that
function (except for superglobals like $_POST, $_SESSION, etc.). In
order to reference a var defined/used outside that function you must
add a global statement in the function:
function xxxx()
{
global $submenu;
...
...
}
I solve my problem creating a class and now it works well.
--- End Message ---
--- Begin Message ---
On Thu, Apr 11, 2013 at 1:12 PM, Rafnews <raf.n...@gmail.com> wrote:
> On 11.04.2013 19:19, Jim Giner wrote:
>>
>> On 4/11/2013 10:48 AM, Rafnews wrote:
>>>
>>> On 11.04.2013 13:34, Rafnews wrote:
>>>>
>>>> Hi,
>>>>
>>>> I would like to insert a piece of HTML code inside several pages.
>>>> all pages are differently named.
>>>>
>>>> i need in each page to find a particular tag, let's say <div
>>>> id="#submenu">...</div> (so based on its ID and tagname) and inside it
>>>> to insert my PHP/HTML code.
>>>>
>>>> how can i do that ?
>>>>
>>>> thx.
>>>>
>>>> A.
>>>
>>>
>>> Ok i can write an include_once('myfile.php');
>>>
>>> however if i have an array in this file, other files where is the
>>> include_once(); do not recognize the array.
>>>
>>> here is an extract of this file to include (submenu.php):
>>> <?php
>>> $submenu = array();
>>> $submenu[] = array('id' => 1,'class'=>'menuitem1');
>>> $submenu[] = array('id' => 2,'class'=>'menuitem2');
>>>
>>> // function in the same file
>>> function DisplayMenu($title){
>>> // here i do not have access to the previous array $submenu define
>>> outside the function
>>> ...
>>> }
>>>
>>> as it is included the function DisplayMenu should also have access to
>>> $submenu array, no ?
>>>
>>>
>>>
>> basic php question. Variables within any function are local to that
>> function (except for superglobals like $_POST, $_SESSION, etc.). In order
>> to reference a var defined/used outside that function you must add a global
>> statement in the function:
>>
>> function xxxx()
>> {
>> global $submenu;
>>
>> ...
>> ...
>> }
>>
> I solve my problem creating a class and now it works well.
Probably the best solution. As you asked the question here, it would
be nice to share your solution so others with a similar problem can
benefit.
--- End Message ---
--- Begin Message ---
I need help with this code to echo all items in the general database and not
just the fields I'm searching for.....
<?php
// filter function
function cleanInput($input) {
$search = array('OEM Name, Category, OEM Name');
$output = str_replace($search, '', $input);
return $output;
}
//define layout name
$layoutName = 'SYSTEMS CONFIGURATOR';
//block for pagination
if(isset($_GET['page']) && !empty($_GET['page'])){
$page = $_GET['page'];
}
else{
$page = 1;
}
$max = "20";
$skip = ($page - 1) * $max;
// grab their search query and clean it
if($_POST){
$searchQuery = $_POST['q'];
$_SESSION['searchQuery'] = $searchQuery;
}
else{
if(!isset($_SESSION['searchQuery'])){
header('location: index.php');
}
}
//$searchQuery = "amat";
// sanitize
$cleanInput = cleanInput($_SESSION['searchQuery']);
// Add 1st request for serial number
$findSerial = $fm->newFindRequest($layoutName);
$findSerial->addFindCriterion('OEM Name', $cleanInput);
// Add 2nd request for category
$findDesc = $fm->newFindRequest($layoutName);
$findDesc->addFindCriterion('Category', $cleanInput);
// search the description field
//$find->addFindCriterion('description', $cleanInput);
// sort the results
//do a compound find with above two search conditions
$compoundFind = $fm->newCompoundFindCommand($layoutName);
$compoundFind->add(1, $findSerial);
$compoundFind->add(2, $findDesc);
$compoundFind->addSortRule('Serial #', 1,
FILEMAKER_SORT_ASCEND);
// set skip and max values
$compoundFind->setRange($skip, $max);
// run the search
$result = $compoundFind->execute();
$records = $result->getRecords();
//get found count and get total page number
$foundCount = $result->getFoundSetCount();
$totalPage = ceil($foundCount / $max);
// create the smarty object
$smarty = new Smarty();
$smarty->force_compile = true;
$smarty->debugging = false;
$smarty->caching = false;
//$smarty->cache_lifetime = 120;
?>
Russell Brackett
Web Developer
Capitol Area Technology
3500 Comsouth Suite 500
Austin, Texas, 78744
rbrack...@capitolabs.com<mailto:c.h...@capitolabs.com>
Office 512-610-3246
Cell 979-412-3018
Capitol Area Technology:
Integrity-Courtesy-Customer Satisfaction
--- End Message ---
--- Begin Message ---
On Thu, Apr 11, 2013 at 1:37 PM, Russell Brackett
<rbrack...@capitolabs.com> wrote:
> I need help with this code to echo all items in the general database and not
> just the fields I'm searching for.....
>
> <?php
>
> // filter function
> function cleanInput($input) {
>
> $search = array('OEM Name, Category, OEM Name');
>
> $output = str_replace($search, '', $input);
> return $output;
> }
> //define layout name
> $layoutName = 'SYSTEMS CONFIGURATOR';
>
> //block for pagination
> if(isset($_GET['page']) && !empty($_GET['page'])){
> $page = $_GET['page'];
> }
> else{
> $page = 1;
> }
>
> $max = "20";
> $skip = ($page - 1) * $max;
>
> // grab their search query and clean it
> if($_POST){
> $searchQuery = $_POST['q'];
> $_SESSION['searchQuery'] = $searchQuery;
> }
> else{
> if(!isset($_SESSION['searchQuery'])){
> header('location: index.php');
> }
> }
> //$searchQuery = "amat";
>
> // sanitize
> $cleanInput = cleanInput($_SESSION['searchQuery']);
>
> // Add 1st request for serial number
> $findSerial = $fm->newFindRequest($layoutName);
> $findSerial->addFindCriterion('OEM Name', $cleanInput);
>
>
> // Add 2nd request for category
> $findDesc = $fm->newFindRequest($layoutName);
> $findDesc->addFindCriterion('Category', $cleanInput);
> // search the description field
> //$find->addFindCriterion('description', $cleanInput);
>
> // sort the results
> //do a compound find with above two search conditions
> $compoundFind = $fm->newCompoundFindCommand($layoutName);
> $compoundFind->add(1, $findSerial);
> $compoundFind->add(2, $findDesc);
> $compoundFind->addSortRule('Serial #', 1,
> FILEMAKER_SORT_ASCEND);
>
> // set skip and max values
> $compoundFind->setRange($skip, $max);
>
> // run the search
> $result = $compoundFind->execute();
> $records = $result->getRecords();
>
> //get found count and get total page number
> $foundCount = $result->getFoundSetCount();
> $totalPage = ceil($foundCount / $max);
>
> // create the smarty object
> $smarty = new Smarty();
> $smarty->force_compile = true;
> $smarty->debugging = false;
> $smarty->caching = false;
> //$smarty->cache_lifetime = 120;
> ?>
> Russell Brackett
> Web Developer
>
> Capitol Area Technology
> 3500 Comsouth Suite 500
> Austin, Texas, 78744
> rbrack...@capitolabs.com<mailto:c.h...@capitolabs.com>
> Office 512-610-3246
> Cell 979-412-3018
>
> Capitol Area Technology:
> Integrity-Courtesy-Customer Satisfaction
>
Where do these methods come from?
> // Add 1st request for serial number
> $findSerial = $fm->newFindRequest($layoutName);
> $findSerial->addFindCriterion('OEM Name', $cleanInput);
>
>
> // Add 2nd request for category
> $findDesc = $fm->newFindRequest($layoutName);
> $findDesc->addFindCriterion('Category', $cleanInput);
> // search the description field
> //$find->addFindCriterion('description', $cleanInput);
>
> // sort the results
> //do a compound find with above two search conditions
> $compoundFind = $fm->newCompoundFindCommand($layoutName);
> $compoundFind->add(1, $findSerial);
> $compoundFind->add(2, $findDesc);
> $compoundFind->addSortRule('Serial #', 1,
> FILEMAKER_SORT_ASCEND);
>
> // set skip and max values
> $compoundFind->setRange($skip, $max);
>
> // run the search
> $result = $compoundFind->execute();
I'm not familiar with them as one of the usual PHP database extensions.
--- End Message ---