php-general Digest 22 Nov 2010 19:00:57 -0000 Issue 7049

Topics (messages 309606 through 309611):

Re: My project requires creating office documents on PHP. Any recommendations 
on what to use?
        309606 by: Aman Singh

Re: Problem with functions and arrays...
        309607 by: Richard Quadling

Re: MySQL Query Help
        309608 by: Simcha Younger

Mysql data encryption / Transparent data encyrption
        309609 by: nitesh nandy

Re: Wordpress Page: How to add pagination?
        309610 by: Rico Secada
        309611 by: Bastien Koert

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Not sure of all office documents, but for Excel, you may want to try out
http://phpexcel.codeplex.com/?ocid=soc-c-in-loc--cfp<http://www.google.com/url?q=http%3A%2F%2Fphpexcel.codeplex.com%2F%3Focid%3Dsoc-c-in-loc--cfp&sa=D&sntz=1&usg=AFrqEzdAuwZxP4NwbHVSOl8dkY6mlt2YoQ>.
>From the page: "Project providing a set of classes for the PHP programming
language, which allow you to write to and read from different file formats,
like Excel 2007, PDF, HTML, ... This project is built around Microsoft's
OpenXML standard and PHP."



On Sat, Nov 20, 2010 at 11:40 AM, chetan ahuja <[email protected]>wrote:

> My project requires creating office documents on PHP. Any recommendations
> on
> what to use?
>

--- End Message ---
--- Begin Message ---
On 20 November 2010 23:31, Jason Pruim <[email protected]> wrote:
> Hey Everyone!
>
> So I came across a problem that I don't know how to fix... I have searched
> and thought and just not having anything click as to where I am messing
> up...
>
> I have a few functions as follows:
> <?PHP
>
> function ddbYear($name, $message, $_POST, $option){
>
>    //Make sure to post form start/stop OUTSIDE of this function...
>    //It's not meant to be a one size fits all function!
> echo "NAME: " . $name . "<BR>";
> echo "MESSAGE: " . $message . "<BR>";
>
> echo "POST: " . $_POST . "<BR>";
> echo "OPTION: " . $option . "<BR>";
>
>
> $sticky = '';
> if(isset($_POST['submit'])) {
> $sticky = $_POST["{$name}"];
> echo "STICKY: " . $sticky;
> }
> //echo "OPTION: ";
> //print_r($option);
>
>    echo <<<HTML
> <select name="{$name}">
> <option value="0">{$message}</option>
>
> HTML;
>
> foreach ($option as $key => $value){
>
> if($key == $sticky) {
> echo '<option value="' . $key .'" selected>' . $value . '</option>';
> }else{
> echo '<option value="' . $key .'">' . $value . '</option>';
> }
>
> }
>
> echo <<<HTML
>
> </select>
> HTML;
> unset($value);
> return;
> }
>
> ?>
>
> One for Month, Day & Year... All the same exact code... When I get brave
> I'll combine it into 1 functions :)
>
> Now... What it's trying to do.. It's on a "update" form on my website.
> Basically pulls the info from the database and displays it in the form again
> so it can be edited and resubmitted...
>
> As I'm sure you can tell from the function it checks to see if the a value
> has been selected in the drop down box and if it has then set the drop down
> box to that value.
>
> I call the function like this:
> <?PHP
> $startYear = date("Y", $row['startdate']); //Actual DBValue: 1265000400
> $optionYear = array("2010" => "2010", "2011" => "2011", "2012" => "2012",
> "2013" => "2013", "2014" => "2014");
>
> ddbYear("startYear", "Select Year", $startYear, $optionYear);
>
>
> ?>
>
> The output I'm getting is:
> THESE ARE THE ACTUAL UNPROCESSED (OTHER THEN SEPARATING) VALUES FROM THE
> DATABASE
> startmonth: 2
> startday: 1
> startYear: 2010
> endmonth: 11
> endDay: 30
> endYear: 1999
>
> THESE ARE THE VALUES INSIDE THE FUNCTION
> NAME: startYear
> MESSAGE: Select Year
> POST: 2010
> OPTION: Array
> STICKY: 2
>
> Now... The problem is that $sticky get set to "2" instead of "2010"... But I
> can't figure out why...
>
> Anyone have any ideas?
>
> And just incase I didn't provide enough info here's a link that shows it
> happening:
>
> HTTP://jason.pruimphotography.com/dev/cms2/events/update_form.php?id=62
>
> Thanks for looking and for your answers in advance! :)
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

It is extremely counter-intuitive to have parameters named after
superglobal variables.

<?php
/**
 * This function looks like it does nothing.
 */
function EmptyFunction($_POST)
        {
        }

// Build $_GET
$_GET['Name'] = 'Richard';

print_r($_GET);
print_r($_POST);

EmptyFunction($_GET);

print_r($_GET);
print_r($_POST);
?>

Rather than doing nothing, any parameter passed to it will be assigned
to the super global $_POST array.

There is no "pass be reference" &$_POST which would be one way to
alter a variable that exists outside of the scope of the function.

If your intention _IS_ to assign to the $_POST super-global, then just
assign it. Don't pass it.

Using any super global as a parameter is almost always NOT going to
have the intent required.

Things get really quite odd if the parameter is $GLOBALS.

<?php
function EmptyFunction($GLOBALS)
        {
        }

// Build $_GET
$_GET['Name'] = 'Richard';

$Age = 43;
EmptyFunction($_GET);
var_dump($GLOBALS);
echo $Name, $Age;
?>

The output here is ...

array(1) {
  ["Name"]=>
  string(7) "Richard"
}

Notice: Undefined variable: Name in Z:\testsg.php on line 12
43


So, the link between the global variables and $GLOBALS super global is
now broken.

$Name isn't in global scope and $Age isn't in $GLOBALS.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
On Sun, 21 Nov 2010 11:19:04 -0700
"Ben Miller" <[email protected]> wrote:

> 
> To help clarify - the 3 tables look something like the following (tableName
> => column,column,column...):
> 
> Products => product_id,product_name,product_description...  (key =
> product_id)
> Criteria => criteria_id,criteria_title,criteria_text,...  (key =
> criteria_id)
> Criteria_values => product_id,criteria_id,criteria_value,... (key =
> product_id & criteria_id)
> 
> The user selects up to X product_id's to compare, stored in
> $selected_products.
> 
> I then need to get each criteria_title and criteria_text from
> table(criteria) where there is a matching criteria_id in
> table(criteria_values) for each/all $selected_products, also returning the
> criteria_value for each $selected_products, ultimately ending up with an
> array or object that looks something like:
> 
> (Assuming the user selected Product A (product_id=1), Product B
> (product_id=2) and Product C (product_id=3)
> 
> criteria => Array  (
>       [$criteria_id] => Array (
>               [title] => query_row[criteria_title]
>               [text] => query_row[criteria_text]
>               [values] => Array (
>                       [1] => Product A's value for this criteria
>                       [2] => Product B's value for this criteria
>                       [3] => Product C's value for this criteria
>               )
>       )
>       [$criteria_id] => Array (
>               .....
>       )
> )
> 
> Again, displaying only/all criteria where there is a matching value for
> each/all $selected_products
> 
> Thanks again,
> Ben
> 
> 

You should probably select all relevant rows for each product, without checking 
that a given criteria has a matching value for each product. Use php to filter 
out the criteria which do not apply to all products.

-- 
Simcha Younger <[email protected]>

--- End Message ---
--- Begin Message ---
Hello,

This doesn't relates to php directly.

Oracle , MSSQL supports TDE  innately. Is there any way to adding that
support to mysql too ? Looking for some free, opensource solution.

Something which won't be much of a hit on performance.

thanks

-- 
Regards,

Nitesh Nandy

--- End Message ---
--- Begin Message ---
On Mon, 22 Nov 2010 09:27:28 +0800 (SGT)
vince samoy <[email protected]> wrote:

Hi Vince.

This is not a Wordpress mailing list. This is the general users PHP
mailing list.

> Hi guys,
> 
> I was wondering if this is the right place that this question of mine
> might get an answer. I'm currently working on a website project and
> I'm trying to add a pagination on a "Wordpress Page" as I might call
> it.
> 
> I was able to make it work on the archive.php page. Please take note
> that this page is calling out 3 "Posts" on each page and that the
> pagination is working.
> 
> Link: http://lgrathletics.com/lgr/category/basketball
> 
> Code:
> 
> <?php get_header();?>
> 
> <?php get_sidebar();?>
> 
> <div class="main-contents">this is the archive
> <div id="gridContainer">
> 
> <div class="category_title"><h2><?php single_cat_title(); ?>
> </h2></div>
> 
> <?php
> $c = 1; //init counter
> $bpr = 3; //boxes per row
> 
> if(have_posts()) :
>     while(have_posts()) :
>         the_post();
> ?>
>             <div class="post <?php
> global $wp_query;
> $postid = $wp_query->post->ID;
> 
> echo get_post_meta($postid, 'third_post', true);
> wp_reset_query();
> ?>" id="post-<?php the_ID(); ?>">
>                 <h1 class="title"><a href="<?php the_permalink(); ?>"
> title="<?php the_title_attribute(); ?>"><?php the_title(); ?
> ></a></h1> <div class="postImage"> <a href="<?php the_permalink(); ?
> >>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail
> >>('grid-post-image'); ?></a>
>                 </div>
>                 <div class="postExcerpt">
>                     <?php the_excerpt(); ?>
>                 </div>
>             </div>
> <?php
> if($c == $bpr) :
> ?>
> <div class="clr"></div>
> <?php
> $c = 0;
> endif;
> ?>
> <?php
>         $c++;
>     endwhile;
> endif;
> ?>
> <?php wp_pagenavi(); ?>
> <div class="clr"></div>
> </div>
> </div>
> 
> <?php get_footer(); ?>
> 
> Now, I'm trying to make this work on a template page. With 3 "Pages"
> instead of posts on each page. You'll notice that the pagination is
> not appearing.
> 
> Link: http://lgrathletics.com/lgr/basketball
> 
> Code:
> 
> <?php
> /*
> Template Name: Product Grid
> */
> ?>
> 
> <?php get_header(); ?>
> 
> <?php get_sidebar(); ?>
> 
> <div class="main-contents">this is the product grid
> <div id="gridContainer">
> 
> <div class="category_title"><h2><?php
> $parent_title = get_the_title($post->post_parent);
> echo $parent_title;
> ?>
>  </h2></div>
> 
> <?php if ( (is_page('Products')) or (is_page('Basketball')) ) {
> 
> $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;    
>     
> query_posts(array('showposts' => 3, 'post_parent' => 173, 'post_type'
> => 'page'));
> 
>     while (have_posts()) {
>         
>         the_post(); // vital
>         
>         $thumbPath = get_post_meta($post->ID, 'thumbnail', true);
>         
>         if ($thumbPath == "") {
>             $thumbPath = "/images/comingsoon.png";
>         
>         }
>         
>         ?>
>         <div class="post <?php echo get_post_meta($post->ID,
> 'third_post', true); ?>"> 
>         <h1 class="title"><a href="<?php the_permalink() ?>"
> class="grid-product"> <?php the_title(); ?></a></h1>
>         <div class="postImage">
>             <a href="<?php the_permalink() ?>"
> class="grid-product"><img src="<?php echo $thumbPath ?>"
> alt="" /></a> </div> <div class="postExcerpt">
>                     $<?php echo get_post_meta($post->ID, 'price',
> true); ?> </div>
>                 
>         </div>
>         
>     <?php }
>     
>     wp_reset_query(); // Restore global post data
>     
> }
> ?>
> 
> <?php if(function_exists('wp_pagenavi')) { // if PageNavi is
> activated ?>
> 
> <?php wp_pagenavi(); // Use PageNavi ?>
> 
> <?php } else { // Otherwise, use traditional Navigation ?>
> 
> <div class="nav-previous">
> <!-- next_post_link -->
> </div>
> 
> <div class="nav-next">
> <!-- previous_post_link -->
> </div>
> 
> <?php } // End if-else statement ?>
>  
> <div class="clr"></div>
> </div>
> </div>
> 
> <?php get_footer(); ?>
> 
> 
> I really don't what I'm currently missing or this is something that
> is impossible. Hope you guys can help me out.
> 
> Thanks in advance and good day!
> 
> Vince
> 
> 
> 
> 
>       

--- End Message ---
--- Begin Message ---
On Mon, Nov 22, 2010 at 12:14 PM, Rico Secada <[email protected]> wrote:
> On Mon, 22 Nov 2010 09:27:28 +0800 (SGT)
> vince samoy <[email protected]> wrote:
>
> Hi Vince.
>
> This is not a Wordpress mailing list. This is the general users PHP
> mailing list.
>
>> Hi guys,
>>
>> I was wondering if this is the right place that this question of mine
>> might get an answer. I'm currently working on a website project and
>> I'm trying to add a pagination on a "Wordpress Page" as I might call
>> it.
>>
>> I was able to make it work on the archive.php page. Please take note
>> that this page is calling out 3 "Posts" on each page and that the
>> pagination is working.
>>
>> Link: http://lgrathletics.com/lgr/category/basketball
>>
>> Code:
>>
>> <?php get_header();?>
>>
>> <?php get_sidebar();?>
>>
>> <div class="main-contents">this is the archive
>> <div id="gridContainer">
>>
>> <div class="category_title"><h2><?php single_cat_title(); ?>
>> </h2></div>
>>
>> <?php
>> $c = 1; //init counter
>> $bpr = 3; //boxes per row
>>
>> if(have_posts()) :
>>     while(have_posts()) :
>>         the_post();
>> ?>
>>             <div class="post <?php
>> global $wp_query;
>> $postid = $wp_query->post->ID;
>>
>> echo get_post_meta($postid, 'third_post', true);
>> wp_reset_query();
>> ?>" id="post-<?php the_ID(); ?>">
>>                 <h1 class="title"><a href="<?php the_permalink(); ?>"
>> title="<?php the_title_attribute(); ?>"><?php the_title(); ?
>> ></a></h1> <div class="postImage"> <a href="<?php the_permalink(); ?
>> >>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail
>> >>('grid-post-image'); ?></a>
>>                 </div>
>>                 <div class="postExcerpt">
>>                     <?php the_excerpt(); ?>
>>                 </div>
>>             </div>
>> <?php
>> if($c == $bpr) :
>> ?>
>> <div class="clr"></div>
>> <?php
>> $c = 0;
>> endif;
>> ?>
>> <?php
>>         $c++;
>>     endwhile;
>> endif;
>> ?>
>> <?php wp_pagenavi(); ?>
>> <div class="clr"></div>
>> </div>
>> </div>
>>
>> <?php get_footer(); ?>
>>
>> Now, I'm trying to make this work on a template page. With 3 "Pages"
>> instead of posts on each page. You'll notice that the pagination is
>> not appearing.
>>
>> Link: http://lgrathletics.com/lgr/basketball
>>
>> Code:
>>
>> <?php
>> /*
>> Template Name: Product Grid
>> */
>> ?>
>>
>> <?php get_header(); ?>
>>
>> <?php get_sidebar(); ?>
>>
>> <div class="main-contents">this is the product grid
>> <div id="gridContainer">
>>
>> <div class="category_title"><h2><?php
>> $parent_title = get_the_title($post->post_parent);
>> echo $parent_title;
>> ?>
>>  </h2></div>
>>
>> <?php if ( (is_page('Products')) or (is_page('Basketball')) ) {
>>
>> $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
>>
>> query_posts(array('showposts' => 3, 'post_parent' => 173, 'post_type'
>> => 'page'));
>>
>>     while (have_posts()) {
>>
>>         the_post(); // vital
>>
>>         $thumbPath = get_post_meta($post->ID, 'thumbnail', true);
>>
>>         if ($thumbPath == "") {
>>             $thumbPath = "/images/comingsoon.png";
>>
>>         }
>>
>>         ?>
>>         <div class="post <?php echo get_post_meta($post->ID,
>> 'third_post', true); ?>">
>>         <h1 class="title"><a href="<?php the_permalink() ?>"
>> class="grid-product"> <?php the_title(); ?></a></h1>
>>         <div class="postImage">
>>             <a href="<?php the_permalink() ?>"
>> class="grid-product"><img src="<?php echo $thumbPath ?>"
>> alt="" /></a> </div> <div class="postExcerpt">
>>                     $<?php echo get_post_meta($post->ID, 'price',
>> true); ?> </div>
>>
>>         </div>
>>
>>     <?php }
>>
>>     wp_reset_query(); // Restore global post data
>>
>> }
>> ?>
>>
>> <?php if(function_exists('wp_pagenavi')) { // if PageNavi is
>> activated ?>
>>
>> <?php wp_pagenavi(); // Use PageNavi ?>
>>
>> <?php } else { // Otherwise, use traditional Navigation ?>
>>
>> <div class="nav-previous">
>> <!-- next_post_link -->
>> </div>
>>
>> <div class="nav-next">
>> <!-- previous_post_link -->
>> </div>
>>
>> <?php } // End if-else statement ?>
>>
>> <div class="clr"></div>
>> </div>
>> </div>
>>
>> <?php get_footer(); ?>
>>
>>
>> I really don't what I'm currently missing or this is something that
>> is impossible. Hope you guys can help me out.
>>
>> Thanks in advance and good day!
>>
>> Vince
>>
>>
>>
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

perhaps you could just google wordpress pagination

http://www.google.ca/#sclient=psy&hl=en&q=wordpress+pagination&aq=1&aqi=g4g-o1&aql=&oq=&gs_rfai=&pbx=1&fp=88df74f51cdeec4c

-- 

Bastien

Cat, the other other white meat

--- End Message ---

Reply via email to