Jump to content
David Schwartz

How to display one of several web pages at one URL

Recommended Posts

Here's some pseudo-code that needs to be executed when you visit a particular URL:

 

case TodaysName of
  'mon': ShowPage(1);
  'tue': ShowPage(2);
  . . .
  'fri': ShowPage(5);
end;

ShowPage loads a list of either HTML files or URLs, then sends that page out to the browser. I want to implement this in TMS WebCore, and the app sits at the URL in question.

 

I'm looking at a situation where the pages use a different template for each day. Someone will edit the template for each day eg, on Sunday) and save it; when the URL is viewed in the browser it will display that day's template as edited previously. 

 

The users might create the pages using an HTML page / web editor, or maybe create them in, say, Wordpres, or any number of similar options.

 

Is it sufficient to load up the entire HTML file and send it out to the browser? Or will the header need to be doctored in some way?

I suppose I could also write an app that would let the user edit the pages and save their most relevant details somewhere.

 

I know this isn't specific to WebCore, but may be a fairly common problem with many kinds of services.

Share this post


Link to post

Well, I'm concerned about the "page editor" and dependencies that may be in the HEAD section that may need to be changed.

 

I use "page editor" loosely because it could be just about anything, and could also be done in Wordpress to create the requisite pages.

 

What I want to create is a generic tool that doesn't care what's used to create the pages. What it does is looks at the current date and time and then determines which page to display.

 

I was thinking the page would need to be loaded and partially parsed so the header can be tweaked, but upon further thought, that's probably not necessary.

 

Can I just load a file or URL and send it to the browser as-is?

 

 

 

Edited by David Schwartz

Share this post


Link to post
1 hour ago, David Schwartz said:

Can I just load a file or URL and send it to the browser as-is?

Of course you can but how you suppose to inject website's common scripts and UI? And why would you have to change HEAD - custom scripts?

Share this post


Link to post
15 hours ago, Fr0sT.Brutal said:

Of course you can but how you suppose to inject website's common scripts and UI? And why would you have to change HEAD - custom scripts?

That's what I'm asking about...

 

If I have a script in the document root that loads up a little table that has a filename or URL plus a timestamp of when that page should be displayed, can I simply load the page from a file or the URL and simply send it to the browser without worrying about anything else?

 

For example, if I put a Wordpress site in a folder beneath the document root, then let the user access that to create the pages. The little table used by the script above it would simply need to find the URL to request from the WP site based on the current time vs. times in the list, and then load it up and send it to the browser.

 

The whole purpose of this is to have a mechanism separate from the platform to manage time-based displays of specific pages, which is not something that Wordpress or any other platform I know of does easily. The guy who created this whole model has it implemented on InfusionSoft / Keap and hired one of their consultants to build the whole site for him. The page sequencing is fairly trivial, but  there's no Wordpress plugin I've found that does that. It's sort of antithetical for how most websites work. (Typically, you post a page and the site displays it. There's no notion of "sequencing over time" for the same page URL. In fact, it's quite counter-intuitive. But for this application, it's required.)

 

Analogy: you go into a resturant and they have a daily special that's different each day. A web site works by having a different room you'd go into for that special. But you only want it open on the day that special is being offered. Which means you'd need seven different rooms to handle daily specials each day of the week. That's silly. You just list them by day and you order the "Daily Special". The kitchen can't fix the other ones if you were to ask. That's like a URL in this case -- same URL, different thing served up based on the day. Websites don't work that way.

Share this post


Link to post
On 11/19/2022 at 4:07 PM, David Schwartz said:

Here's some pseudo-code that needs to be executed when you visit a particular URL:

 


case TodaysName of
  'mon': ShowPage(1);
  'tue': ShowPage(2);
  . . .
  'fri': ShowPage(5);
end;

ShowPage loads a list of either HTML files or URLs, then sends that page out to the browser. I want to implement this in TMS WebCore, and the app sits at the URL in question.

 

I'm looking at a situation where the pages use a different template for each day. Someone will edit the template for each day eg, on Sunday) and save it; when the URL is viewed in the browser it will display that day's template as edited previously. 

 

The users might create the pages using an HTML page / web editor, or maybe create them in, say, Wordpres, or any number of similar options.

 

Is it sufficient to load up the entire HTML file and send it out to the browser? Or will the header need to be doctored in some way?

I suppose I could also write an app that would let the user edit the pages and save their most relevant details somewhere.

 

I know this isn't specific to WebCore, but may be a fairly common problem with many kinds of services.

Hi @David Schwartz

 

You would like to do this on client site (at the browser) or server side? Both are easy to implement (not TMS WebCore). If you would like to see a working demo, like my comment and back in tomorrow, I will show you 🙂

  • Like 1

Share this post


Link to post
5 hours ago, David Schwartz said:

If I have a script in the document root that loads up a little table that has a filename or URL plus a timestamp of when that page should be displayed, can I simply load the page from a file or the URL and simply send it to the browser without worrying about anything else?

Well, with a script you can do it. Just fetch page content, split to head|body and assign them to document.head|body.innerHTML.

But you'll have to estimate all hacking possibilities and block them.

Share this post


Link to post
2 hours ago, nglthach said:

Hi @David Schwartz

 

You would like to do this on client site (at the browser) or server side? Both are easy to implement (not TMS WebCore). If you would like to see a working demo, like my comment and back in tomorrow, I will show you 🙂

 

WebCore is obviously overkill for this. I'm thinking PHP is probably better.

 

It's running on somebody's hosting account to allow them to sequence through pages over time and manage the sequencing separately from the pages themselves. Most are using Wordpress.

 

midnight Monday -> show page-1

midnight Wednesday -> show page-2

midnight Friday -> show page-3

midnight Saturday -> show page-4

midnight Sunday -> show page-5

 

With no other pages, then page-5 will always show after that.

 

All will appear at the same URL / home page. The pages can be edited on a Wordpress site installed in a folder that they can get to easily. The page names can be long strings of random characters so they can't be easily guessed. 

 

Perhaps that schedule can be done inside of WP as well by filling in a form and then the script can read it from the WP DB. (Just thinking out loud here...)

 

Share this post


Link to post

Hi @David Schwartz

I don't use WordPress, if you are willing to use Drupal 7 (not the latest one, I haven't worked on Drupal in a long time), here is the solution:

 

- Create pages for Monday, Wednesday, ...

- In settings.php, change $conf['site_frontpage'] to corresponding page for each day

 

I could install this on your host (for free)! Please let me know if you would like!

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×