Hi guys
I have a subdomain with 79 individual episode pages, and I'd like to create a "Next >>" link that reads the number included in the top page name, then adds a value of one, sending the user to the next higher-numbered page within the acceptable range of 01 to 79. Page 79 would wrap back to page 01. This would allow the user to move incrementally while I continue to use a single, embedded navigation page for all episodes.
For example, each page is ep01.html, ep02.html through ep79.html. The embedded navigation page works by targeting "_top" in each link. If the user is on page ep27.html clicks "Next Episode >>" in the navigator they load ep28.html. However, if the user is on page 79, they load ep01.html because they are at the end of the page range.
Here's the full URL of page one:
http://series.airwolf. tv/episodes/ep01.html
and the pending embedded navigator page:
http://series.airwolf. tv/episodes/epguidefinder.h tml
6 1796 Atli 5,058
Recognized Expert Expert
Hi Wolfman.
You can use the $_SERVER['PHP_SELF'] variable to find out the name of the current file, and use that to find out what the next file should be.
Something like: -
# Get the current file name and index of the next file
-
$currentName = basename($_SERVER['PHP_SELF'], ".html");
-
$currentIndex = substr($currentName, -2);
-
$nextIndex = $currentIndex + 1;
-
-
# Make sure the index is not higher than 79
-
if($nextIndex > 79)
-
$nextIndex = 0;
-
-
# Prefix the number with a 0 if it is less than 10
-
if($nextIndex < 10)
-
$nextIndex = "0". $nextIndex;
-
-
# Print the link
-
echo "<a href=\"ep{$nextIndex}.html\">Next</a>";
-
Thanks. I added target=\"_top\" into the href since the link must call the parent window, but other wise embedded it as-is:
[PHP] <?php
# Get the current file name and index of the next file
$currentName = basename($_SERV ER['PHP_SELF'], ".html");
$currentIndex = substr($current Name, -2);
$nextIndex = $currentIndex + 1;
# Make sure the index is not higher than 79
if($nextIndex > 79)
$nextIndex = 0;
# Prefix the number with a 0 if it is less than 10
if($nextIndex < 10)
$nextIndex = "0". $nextIndex;
# Print the link
echo "<a href=\"ep{$next Index}.html\" target=\"_top\" >Next Episode >></a>";
?>[/PHP]
However, each time the link is clicked, it returns to page 01 only. Check it out by selecting any of the first five episodes here: http://series.airwolf.tv/episodes/
You'll see the resulting "next episode>>"link in the little navigator window on the left.
Wolfman
I gone through of your code, and i think the problem is in line
[PHP]
echo "<a href=\"ep{$next Index}.html\" target=\"_top\" >Next Episode >></a>";
[/PHP]
if possible plz try like this
[PHP]
echo "<a href=\"ep.{$nex tIndex}.html\" target=\"_top\" >Next Episode >></a>";
[/PHP]
ok best of luck ..
Thanks. I added target=\"_top\" into the href since the link must call the parent window, but other wise embedded it as-is:
[PHP] <?php
# Get the current file name and index of the next file
$currentName = basename($_SERV ER['PHP_SELF'], ".html");
$currentIndex = substr($current Name, -2);
$nextIndex = $currentIndex + 1;
# Make sure the index is not higher than 79
if($nextIndex > 79)
$nextIndex = 0;
# Prefix the number with a 0 if it is less than 10
if($nextIndex < 10)
$nextIndex = "0". $nextIndex;
# Print the link
echo "<a href=\"ep{$next Index}.html\" target=\"_top\" >Next Episode >></a>";
?>[/PHP]
However, each time the link is clicked, it returns to page 01 only. Check it out by selecting any of the first five episodes here: http://series.airwolf.tv/episodes/
You'll see the resulting "next episode>>"link in the little navigator window on the left.
Wolfman
Thank you robin1983. I changed the line, but regretfully the chage results in an extra period being placed in the page name, but it still defaults to #01 each time. Further thoughts?
Wolfman
I echoed each variable individually and came up with this:
$currentName = epguidefinder.p hp
$currentIndex = hp
$nextIndex = 01
Remember that this script is running on a single page that is loaded within each parent HTML page. The benefit of a working script is that it senses the page it is loaded into, so a single instance serves all.
The embedded page is always called epguidefinder.p hp, so right now the script is detecting the page it's placed on, not the one it's embedded within.
Therefore it's taking the "hp" from "php" and making that the currentIndex variable.
So nextIndex is hp+1, which results in ep01.html every time.
Problem is, I'm not sure how to resolve the code.
First, it must sense the "_top" window, not itself
Second, it must truncate the filename without the .html like it currently did with the .php extension.
Solved it!
I used HTTP_REFERER instead of PHP_SELF.
Thanks everyone for your help!
Wolfman
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of code...
TCHAR myArray;
DoStuff(myArray);
|
by: Bangalore |
last post by:
Hi
In reversing string usring recursive function, i found problems in
using incremental postfix , and incremental prefix
1 void rev(char*);
2 void main()
3 {
4 char s="STRING";
5 rev(s);
|
by: jane |
last post by:
HI,
I had a question on incremental backup.
We had an incremental backup every weekend. We did full backup every
other week. That is one week incremental + full , the other week is
incremental only. My question is for the first weekend incremental
backup, it took for example 1h, but the second weekend incremental
took almost 3 hours. It seems always this way, so I suppose it is not
related to the data change. And we almost had some...
|
by: Jimmy Chen |
last post by:
Recently I've done a db2 backup and restore/recovery, but the process
for recovering the database was different than what I thought to be.
here is what I did:
DB2 is set in online mode
- backup -
* backup db2 in full
* insert record
|
by: apple |
last post by:
UDB v8 fp 6a on AIX 5.1.0.0
Below is a manual incremental recover from compressed backup datasets.
With external compress backup datasets, can it be coded to do an
automatic incremental recover? The manual incremental recover works
just fine, but having trouble getting the automatic incremental recover
to work. Thanks for your help
# INCREMENTAL BACKUP
| |
by: Willem |
last post by:
Based on MK's TSI_SOON (http://www.trigeminal.com/)I've created a
nifty little procedure that - whenever you compact you db you get an
incremental backup copy.
Given that you have a table with version information you get
incremental backups on a per-version basis.
SEE CODE BELOW
Basic idea is: start TSISOON with the options:
1. "compact this db"
|
by: Alex Shturm |
last post by:
Hi,
I am trying to activate incremental link using VC7 (.NET 2003) on a pretty big
project (executable size is more than 100Mb, and it gets linked from several
dozen of libraries and object files of different sizes - from less than 1Mb to
tens of MBs).
The problem is that option /incremental:yes does not have any effect on the
link time. I observe that the linker removes existing executable and re-links
it from scratch.
|
by: Joel Matthew |
last post by:
My boss was asking about incremental backups.
I was scratching my head, thinking that the transaction log and a backup
policy (script) for each record set (sorry about the archaic terminology)
was the usual solution. But there is a some resistance against writing
more code, so I'm wondering what the current state of affairs with
postgresql in regards to incremental backup would be.
A quick search of the lists produced the following:
|
by: Bern McCarty |
last post by:
We have a large mixed dll that I can never seem to get to link incrementally.
Below is the console output. For simplicity I've eliminated some stuff that
we normally do when we really link this dll like manifest embedding and strong
name delay signing. Can anyone see anything wrong with my link command?
Or offer some other explanation why I can never get an incremental link out
of it? To test, I'm just touching one of the source files so...
|
by: nbardach |
last post by:
Hope this finds everyone well. Happy New Year!
I'm trying to build a Loop for a set of dropdown menus I'm inserting into a form.
Basically, the client has to be able to select 1 to 20 donors with the dropdown options (member names) pulled from the DB. When the client is editing a donation record, she needs to be able to view the correct donors for a specific donation record selected in the dropdowns. This means matching the Donor IDs in...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |