Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-18-2012, 03:38 AM   PM User | #31
doubledee
Regular Coder

 
doubledee's Avatar
 
Join Date: Mar 2011
Location: Arizona
Posts: 612
Thanks: 19
Thanked 0 Times in 0 Posts
doubledee has a little shameless behaviour in the past
Quote:
Originally Posted by AndrewGSW View Post
If your page displays ALL messages at once, rather than being paginated, then you could, as you suggest, just pass a yes/no value and execute a query against all the users messages in the database. But if they only check a selection of the messages then you still need to pass this information - that is, which messages were checked - to the other page, using the methods previously discussed.
Sadly, someone pointed out something similar to me at work today, meaning my "great idea" was pretty lame...


Yes, both your and Tango's suggestions seem to be the way to go.


Quote:
If the messages are paginated then, assuming they check ALL, you would need the actioning page to be aware of which page they are currently on. That is, to be able to identify which page/group of messages need to be actioned. Or, again, pass the (full) list of current message-ids to the page.

But I'm not fully aware of your set up so the above information may not prove entirely relevant to your site.
Well, I don't have any pagination currently built in. (Maybe in v3.0?!)

Off topic, if you were on Page 3 of 10 pages in your Inbox, and you checked the Top Check-box - which might/might not then use JavaScript to check all of the boxes below - which would you expect...

1.) Checking the Top Check-box means selecting only those Messages on that Page?

2.) Checking the Top Check-box means selecting *every* Message in your Inbox (across 10 pages)?


Thanks,


Debbie
doubledee is offline   Reply With Quote
Old 12-18-2012, 03:44 AM   PM User | #32
doubledee
Regular Coder

 
doubledee's Avatar
 
Join Date: Mar 2011
Location: Arizona
Posts: 612
Thanks: 19
Thanked 0 Times in 0 Posts
doubledee has a little shameless behaviour in the past
Quote:
Originally Posted by tangoforce View Post
Ok, ignore the incoherent mumblings about passing by reference... I've found a hack

This should be about right (it's late you might need to make minor adjustments but I've run tons of experiments and stuff before putting this together):
Reminder to Tango... Debbie doesn't know OOP yet!!

I had a rough day at work, and my back is killing me.

Will try and re-read this entire thread when I have time this week, and then formulate some questions as to where I'm stuck.

I do know - as AndrewGSW mentioned - that my "solution" last night turned out to be a dud. *sigh*

Thanks for you guys sticking with me, though.


Debbie
doubledee is offline   Reply With Quote
Old 12-18-2012, 07:37 AM   PM User | #33
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Quote:
Off topic, if you were on Page 3 of 10 pages in your Inbox, and you checked the Top Check-box - which might/might not then use JavaScript to check all of the boxes below - which would you expect...

1.) Checking the Top Check-box means selecting only those Messages on that Page?

2.) Checking the Top Check-box means selecting *every* Message in your Inbox (across 10 pages)?
You would really have to stick to how Yahoo, GMail, etc., behave. That is, to only refer to the current page's messages: this is how the user would expect it to behave. Besides, there can possibly be hundreds/thousands of messages, so it could be risky to try and action them all at once.

If the messages were paginated I suggest that you would probably still need to store all the message ids for the current page (when they select All): they may have two windows open and be modifying, or creating, a message in another window, so Page 3 would no longer identify the same collection of messages.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 12-18-2012, 11:53 AM   PM User | #34
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,498
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by doubledee View Post
1.) Checking the Top Check-box means selecting only those Messages on that Page?

2.) Checking the Top Check-box means selecting *every* Message in your Inbox (across 10 pages)?
Option 1. As Andrew says, only apply to the current page otherwise a user might think they're deleting just the first page worth of messages and wipe out everything - some of which they may of been intentionally saving.

No worries about OOP, I don't know it either. Never been worried about using it and frankly I ain't worried about it either. I just get to grips with stuff as I go along.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Old 12-19-2012, 04:21 AM   PM User | #35
doubledee
Regular Coder

 
doubledee's Avatar
 
Join Date: Mar 2011
Location: Arizona
Posts: 612
Thanks: 19
Thanked 0 Times in 0 Posts
doubledee has a little shameless behaviour in the past
Quote:
Originally Posted by AndrewGSW View Post
You would really have to stick to how Yahoo, GMail, etc., behave. That is, to only refer to the current page's messages: this is how the user would expect it to behave.
Yeah, I never thought about that until now.

It doesn't help that I am not up to pagination yet. (Guess I better learn that quickly before people start having hundreds of messages piling up in their Inboxes?!)


Quote:
Besides, there can possibly be hundreds/thousands of messages, so it could be risky to try and action them all at once.
Agreed!


Quote:
If the messages were paginated I suggest that you would probably still need to store all the message ids for the current page (when they select All): they may have two windows open and be modifying, or creating, a message in another window, so Page 3 would no longer identify the same collection of messages.
You lost me there.


What I am seeing, is that sticking all of the Messages for the current Page/View into something (e.g. an Array) is the thing I need to do.

So I think a lot of your and Tango's advice will still apply.

I have so little time during the week, and the next two will be crazy. But when I do have time, I hope to re-read this thread from the start, and see if I can put the pieces together and get this figured out...

Sincerely,


Debbie
doubledee is offline   Reply With Quote
Old 12-21-2012, 09:07 AM   PM User | #36
rajdeep01
New Coder

 
Join Date: Dec 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
rajdeep01 can only hope to improve
In PHP you can return one and only one value from your user functions, but you are able to make that single value an array, thereby allowing you to return many values.

<?php
function dofoo() {
$array["a"] = "Foo";
$array["b"] = "Bar";
$array["c"] = "Baz";
return $array;
}

$foo = dofoo();
?>
rajdeep01 is offline   Reply With Quote
Old 12-21-2012, 01:12 PM   PM User | #37
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,498
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by rajdeep01 View Post
In PHP you can return one and only one value from your user functions, but you are able to make that single value an array, thereby allowing you to return many values.

<?php
function dofoo() {
$array["a"] = "Foo";
$array["b"] = "Bar";
$array["c"] = "Baz";
return $array;
}

$foo = dofoo();
?>
Perhaps if you read the opening post you would understand that this was about an array being passed by $_POST to a script not just returning a result from a php function.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Old 12-31-2012, 10:56 AM   PM User | #38
rajdeep01
New Coder

 
Join Date: Dec 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
rajdeep01 can only hope to improve
$key_label = false;
$key_label = '<span class="hl_reference"><u>key references:</u></span>';

foreach($reference_keys as $value)
{
echo $value .'&nbsp;';
}

if(array($value => 1) && !$key_label)
{
$key_label = true;
echo $key_label;
};
rajdeep01 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:29 PM.


Advertisement
Log in to turn off these ads.