I don't know how to explain this action, basically a web page will show
a brief format and there'll be a link the says "show more" and when
clicked more text shows. eg. goto http://www.newegg.com/app/ViewProduc...19-101&depa=10
and scroll down to the customer reviews, you'll see some reviews have a
link named "See complete" - and that's the action I want. They are doing
that will javascript. Is there a way to do this with pure php?
Thanks 14 1991
> http://www.newegg.com/app/ViewProduc...19-101&depa=10 and scroll down to the customer reviews, you'll see some reviews have
a link named "See complete" - and that's the action I want. They are
doing that will javascript. Is there a way to do this with pure php?
About the only way you could do this server-side is by repainting the
entire page. That is, the "See complete" link would simply be <a
href="mypage.php?open=1">See complete</a> and your page would check for
$_REQUEST['open']==1 and conditionally paint the entire text.
--cd
Also sprach leegold2: http://www.newegg.com/app/ViewProduc...19-101&depa=10 and scroll down to the customer reviews, you'll see some reviews have a link named "See complete" - and that's the action I want. They are doing that will javascript. Is there a way to do this with pure php?
Sure. The reviews are read from a database, I suppose, and are to be shown
either "complete" or "incomplete". Assign an id to each review in PHP and
make the "See complete" links something like http://foo.bar/page.php?showcomplete=id&showothers=xxx, where id is the id
of this review and xxx somehow represents the state of the other reviews
(e.g. a binary number where set/reset bits mean that the corresponding
review is complete/incomplete). Then have your PHP script look for the
variables showcomplete and showothers and use this information to generate
the page, including the "See complete" links with the updated showothers
variable. There may be other ways to achieve the same result, but this is
the one that first came to my mind.
leegold2 <le*****@nospam.net> wrote in message news:<9Dgid.95$2c5.16@trnddc01>... I don't know how to explain this action, basically a web page will show a brief format and there'll be a link the says "show more" and when clicked more text shows. eg. goto
http://www.newegg.com/app/ViewProduc...19-101&depa=10
and scroll down to the customer reviews, you'll see some reviews have a link named "See complete" - and that's the action I want. They are doing that will javascript. Is there a way to do this with pure php?
Thanks
not really.
the complete text of the review is already included in the doc from
the start, but only partly visible. the javascript just toggles the
visibility of the second part of the text. this is done pure
clientside and therefore impossible with php.
a similar behaviour done in php could work like this:
1. user requests page, display page with 1st part of text
2. user clicks 'view comlete', this request is sent back to the server
and includes some information about how to view the page
3. php generates and sends the page again, this time showing the whole
text
micha
leegold2 <le*****@nospam.net> wrote in message news:<9Dgid.95$2c5.16@trnddc01>... I don't know how to explain this action, basically a web page will show a brief format and there'll be a link the says "show more" and when clicked more text shows. eg. goto
http://www.newegg.com/app/ViewProduc...19-101&depa=10
and scroll down to the customer reviews, you'll see some reviews have a link named "See complete" - and that's the action I want. They are doing that will javascript. Is there a way to do this with pure php?
Thanks
PHP is server-side
Javascript and CSS are client side.
Your answer is "no"
you could have the "show complete" load a new page and change it up
however you want. (rather than the "dynamic html" stuff)
> PHP is server-side Javascript and CSS are client side.
Your answer is "no"
Thank you all for the posts and the information. Maybe this is case were
I want to sprinkle in a little javascript, as lttle as possible.
you could have the "show complete" load a new page and change it up however you want. (rather than the "dynamic html" stuff)
> this is done pure clientside and therefore impossible with php.
Micha didn't really push how important this distinction is. You're
trying to make a server-side language do client-side work.
PHP is a great language because it is server-side and therefore we
have complete control over it. JavaScript on the other hand is run by
the browser of the person accessing the webpage; of course we have no
control over what version of browser or whatever they're using.
There are two commonly taken approaches to this quandry.
A) Drop javascript for a couple of years
B) Pander to every browser and make sure it works perfectly (you might
note that this is only worth doing in the case that the JavaScript is
extremely important. In the case of opening reviews it's kinda
pointless but newegg has a lot of money to throw around)
Option A involves no risk at all. Option B can drive a business into a
giant hole by estranging customers. (Can you tell which side I'm on?)
I noticed that Message-ID: <gIzid.2007$Uy5.101@trnddc07> from leegold2
contained the following: Thank you all for the posts and the information. Maybe this is case were I want to sprinkle in a little javascript, as lttle as possible.
Indeed, JavaScript should only be used for non critical applications. If
you make the entire review accessible /only/ to people with JavaScript
enabled then a significant number of people will not have access to it.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Also sprach Chuck Vose:
[No control over client side JavaScript] There are two commonly taken approaches to this quandry. A) Drop javascript for a couple of years
Why "a couple of years"? Do you think in 2010 web designers will have
complete remote comtrol over every client's PC?
B) Pander to every browser and make sure it works perfectly (you might note that this is only worth doing in the case that the JavaScript is extremely important. In the case of opening reviews it's kinda pointless but newegg has a lot of money to throw around)
C) (Not necessarily in contradiction with the other two) Minimize the need
for using JavaScript (thus: no JavaScript needed on most pages). Use
JavaScript in a way that will ensure the site's usability even when
JavaScript or some of its features are not supported by the client.
You can do it without Javascript, but the page has to be refreshed...
(Which really shouldnt be a HUGE problem.)
Just assign a variable when the link is clicked. Say you have this
script on index.php make your href: index.php?show_more=1
Then use an if statement to check for that variable, and if it is there
then show them what they want to see, if it is not, show the link to
"show more" IE:
if ($show_more) {
echo 'The Stuff You Want To See!';
}
else {
echo '<a href="index.php?show_more=1">Show me more</a>';
}
I hope that helps...
leegold2 wrote: I don't know how to explain this action, basically a web page will
show a brief format and there'll be a link the says "show more" and when clicked more text shows. eg. goto
http://www.newegg.com/app/ViewProduc...19-101&depa=10 and scroll down to the customer reviews, you'll see some reviews have
a link named "See complete" - and that's the action I want. They are
doing that will javascript. Is there a way to do this with pure php?
Thanks
Chuck Vose wrote: this is done pure clientside and therefore impossible with php.
Micha didn't really push how important this distinction is. You're trying to make a server-side language do client-side work.
I understand the distiction now. I'm just going to test on the recent
versions of IE, MOZ/NS and Opera. If I sense a browser's not JS enabled
I sidestep the javascript for that instance.
.....snip... There are two commonly taken approaches to this quandry. A) Drop javascript for a couple of years B) Pander to every browser and make sure it works perfectly (you might note that this is only worth doing in the case that the JavaScript is extremely important. In the case of opening reviews it's kinda pointless but newegg has a lot of money to throw around)
Option A involves no risk at all. Option B can drive a business into a giant hole by estranging customers. (Can you tell which side I'm on?)
I'm not a fan of JS either.
John Postlethwait wrote: You can do it without Javascript, but the page has to be refreshed... (Which really shouldnt be a HUGE problem.)
Should I worry about accessing the MYSQL repeated times? It seems to
"look" better if the page's not refreshed. I vastly prefer PHP but it
seems like...I'll have to think about it more... Just assign a variable when the link is clicked. Say you have this script on index.php make your href: index.php?show_more=1
Then use an if statement to check for that variable, and if it is there then show them what they want to see, if it is not, show the link to "show more" IE:
if ($show_more) { echo 'The Stuff You Want To See!'; }
else { echo '<a href="index.php?show_more=1">Show me more</a>'; }
I hope that helps...
leegold2 wrote:
I don't know how to explain this action, basically a web page will
show
a brief format and there'll be a link the says "show more" and when clicked more text shows. eg. goto
http://www.newegg.com/app/ViewProduc...19-101&depa=10
and scroll down to the customer reviews, you'll see some reviews have
a
link named "See complete" - and that's the action I want. They are
doing
that will javascript. Is there a way to do this with pure php?
Thanks
I as a JS and PHP developer see an odvious solution that no one else
seems to see.
Use both Javascript *and* PHP
This might take a lot more work is some applications, but everything
works on non JS browsers and works instantaneously on JS browsers.
something like:
<a href="index.php?more=1" onclick="this.href='#';more(this)">Show full
review</a>
the more() JS function will be run if JS works and no page will br
loaded.
In non-JS supporting browsers, index.php(or the page that it is on)
gets passed to a $_GET variable(should be accessed vie $_REQUEST
thought)
all the ways mentioned above using $_REQUEST etc. could be used plus a
simple JavaScript.
This javascript would have to take into account page structure so I
wont write it out now(this is also a PHP NG not a JS one).
hope that helps
--Infinull
Also sprach leegold2: Should I worry about accessing the MYSQL repeated times? It seems to "look" better if the page's not refreshed. I vastly prefer PHP but it seems like...I'll have to think about it more...
Another option: Let non-JavaScript users see the full text of all reviews
and give JavaScript users the incomplete review with the option to
"complete" it. If there are too many reviews per page, split them into
multiple pages. Simple and everyone is happy.
Also sprach in******@yahoo.com: I as a JS and PHP developer see an odvious solution that no one else seems to see. Use both Javascript *and* PHP This might take a lot more work is some applications, but everything works on non JS browsers and works instantaneously on JS browsers. something like: <a href="index.php?more=1" onclick="this.href='#';more(this)">Show full review</a> the more() JS function will be run if JS works and no page will br loaded. In non-JS supporting browsers, index.php(or the page that it is on) gets passed to a $_GET variable(should be accessed vie $_REQUEST thought)
The page would need to contain the full text of every review, part of which
would have to be hidden using CSS. PHP could "toggle" between full and
incomplete views assigning two CSS classes accordingly. But then it would be
simpler to simply show non-JavaScript users the full text. It won't kill
them. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sue |
last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided
to improve character checking on my project. In my project I only had
to do very basic validation. Therefore, I only had one...
|
by: Cardman |
last post by:
Greetings,
I am trying to solve a problem that has been inflicting my self
created Order Forms for a long time, where the problem is that as I
cannot reproduce this error myself, then it is...
|
by: Jim |
last post by:
Hello,
I have a simple problem which I am guessing has an easy answer within
JavaScript.
I have a form1 with two fields, field1 and field2. I want the contents of
field1 to be transferred to...
|
by: binnyva |
last post by:
Hello Everyone,
I have just compleated a JavaScript tutorial and publishing the
draft(or the beta version, as I like to call it) for review. This is
not open to public yet.
The Tutorial is...
|
by: Mickey Segal |
last post by:
The long-simmering Eolas patent dispute:
http://www.microsoft.com/presspass/press/2003/oct03/10-06EOLASPR.mspx
has led to an optional Microsoft Update:
http://support.microsoft.com/kb/912945/en-us...
|
by: Jake Barnes |
last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching
for "how to play a sound with Javascript". I'm somewhat suprised that
the majority of entries are from the 1990s, and there are...
|
by: Mtek |
last post by:
Hi,
I know there are lots of pages on this, but why can't I find something
simple?
I have an image on my page. All I want is when the mouse rolls over
the image, an image will appear next to...
|
by: lorlarz |
last post by:
Unobtrusive JavaScript leads to BUILDERS (e.g. drag drop activity
builder)
Once you totally remove JS from a web page, and learn the shortcuts
and efficiencies
provided by a library like...
|
by: lorlarz |
last post by:
Here, let's see what you JavaScript programmers have got
Here is a place to share your large or larger full-blown JavaScript
applications:
real.comp.lang.js.apps (a new google group)
Here is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |