Question

I'm aware of this code:

http://<?php echo$server; ?>

This is the $server call:

$server = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

My website's URL is configured like this: http://mywebsite.com/number-text-text-text (i.e. www.mywebsite.com/37-this-is-the-title-of-the-video).

To make a long story short, I'm trying to configure the DISQUS system on my website and I have to figure out how to properly formulate the disqus_url variable.

I have a video website (user submits videos, therefore the URL link is the submission number + the video title, separated by "-"), so whenever a user submits a new video, the newest video is shown on the home page. In other words, the video is "inserted" into the main page, but it does have its own link.

Therefore, using "php echo$server" creates a problem where same comments are displayed by DISQUS on the main page, because will automatically convert to http://www.mywebsite.com instead of www.mywebsite.com/37-this-is-the-title-of-the-video.

I hope I'm explaining this clear enough. I need to see if it's possible to create a command in PHP that lets me call on the video's page, which is needed to be done for the main page to view the correct comments.

Was it helpful?

Solution

Look at $_SERVER. You will need to construct it yourself using maybe SERVER or HOST, REQUEST_URI, QUERY_STRING, etc.. depending on what exactly you need.

OTHER TIPS

Somewhere in your code for the main page, it is getting the identity of the video to display. You need to set $server to the unique url for that video not the values from $_SERVER, which is just going to point to the current page (in this case the root of the site), regardless of which video is actually on that page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top