Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP coding help needed

Featured Replies

Hi, I have a embedded video website comprised of a main page, with header (head.php). Head.php contains the usual meta info on top. Ex:

 

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>blah blah</title>

<meta name="robots" content="index, follow" />

<meta name="revisit-after" content="1 days" />

<meta name="keywords" content="blah blah" />

<meta name="description" content="blah blah " />

 

The title and keywords on head.php are static when on main page, which is fine with me.

 

Here's my problem/question:

 

When I were to click one of my movie thumbs from the main page, it opens up a viewer page called view_video.php. This page contains a unique title of the video, along with tags (keywords). I want to be able to have the video title appear in <title>blah blah</title> and the tags appear in <meta name="keywords" content="blah blah" />.

 

The title/tags come from mysql database.

 

This way every video page has it's own unique title/keywords for the google bots to crawl.

 

This should help, I've posted my code.

 

head.php : http://pastebin.co.za/650

view_video.php : http://pastebin.co.za/651

 

Title is defined as: $video['title'];

Tags defined as : $video['tags']

 

Hope someone can figure this one out!

Thanks!!

What parameters are you passing to view_video.php?

If you're passing the video id in the url for example, each thumbnail link would look something like this:

<a href="view_video.php?vid=1"><img src="mythumbnail.jpg" /></a>

Then on view_video.php, check for the vid parameter and pull relevant info from the database.

A simple example below:

<?php
if (isset($_GET['vid'])) {
$vid = (int) $_GET['vid'];
}
$query = "SELECT title, tags FROM videos WHERE vid_id = $vid";
$result = mysql_query($query);
if ($result) {
$row = mysql_fetch_array($result, MYSQL_ASSOC);
}
?>

Then spit out the info wherever you want it in your html page:

<title> <?php echo $row['title']; ?></title>

Sorry if that's not what you meant.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.