Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 914809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:46:47+00:00 2026-05-15T17:46:47+00:00

I am working with a CMS for a web app in PHP, that has

  • 0

I am working with a CMS for a web app in PHP, that has the needs of shortening the process for inserting (embedding) stuff, like a video from youtube or vimeo by wroting the following, which are stored in the database:

<youtube id="wfI0Z6YJhL0" />

Which would output the following after some sort of replace:

<!-- Custom formatting before object !-->
<object width="640" height="385"><param name="movie" value="http://www.youtube-nocookie.com/v/wfI0Z6YJhL0&amp;hl=sv_SE&amp;fs=1?rel=0&amp;color1=0xe1600f&amp;color2=0xfebd01"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/wfI0Z6YJhL0&amp;hl=sv_SE&amp;fs=1?rel=0&amp;color1=0xe1600f&amp;color2=0xfebd01" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
<!-- Custom formatting after object !-->

How could I do this in PHP?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:46:48+00:00Added an answer on May 15, 2026 at 5:46 pm

    I’ve written a class that does exactly what you ask for my own cms. I’ve uploaded the src for you as although I’ve never released it the source is released under a BSD style license. Custom Tags

    It basically allows you do do exactly what you ask for. In the class there are some example custom tags so I won’t paste code here. Let me know how you go.

    Edit 1: Example Code as requested. 🙂

    Edit 2: I should add it supports buried custom tags.

    Edit 3: It also supports inline templating and tag substitution, ie

    <ct:inline some="attribute">
        This is an in line template. <br />
        This is a #{tag} that can be accessed by the callback function
    </ct:inline>
    

    PHP/HTML: example.php

    <?php
    
    $current_dir = dirname(__FILE__).DIRECTORY_SEPARATOR;
    require_once dirname($current_dir).DIRECTORY_SEPARATOR.'customtags.php';
    
    $ct = new CustomTags(array(
        'parse_on_shutdown'     => true,
        'tag_directory'         => $current_dir.'tags'.DIRECTORY_SEPARATOR,
        'sniff_for_buried_tags' => true
    ));
    
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    
    <html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>untitled</title>
        <meta name="generator" content="TextMate http://macromates.com/">
        <meta name="author" content="Oliver Lillie">
        <!-- Date: 2010-07-10 -->
    </head>
    <body> 
    
        <ct:youtube id="wfI0Z6YJhL0" />
    
    </body>
    </html>
    

    Custom Tag PHP Function: tags/youtube/tag.php:

    function ct_youtube($tag)
    {
        return '<object id="'.$tag['attributes']->id.'" value="http://www.youtube.com/v/'.$tag['attributes']->id.'" /><param ......>';
    }
    

    Output:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd"> 
    
    <html lang="en"> 
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
        <title>untitled</title> 
        <meta name="generator" content="TextMate http://macromates.com/"> 
        <meta name="author" content="Oliver Lillie"> 
        <!-- Date: 2010-07-10 --> 
    </head> 
    <body> 
    
        <object id="wfI0Z6YJhL0" value="http://www.youtube.com/v/wfI0Z6YJhL0" /><param ......> 
    
    </body> 
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a web app (CMS) that loads controls dynamically into a holder
i am working on a web application that now requires a CMS. Could you
My web development experience has mostly been setting up a CMS like Wordpress or
I am working on a cms and there are some simple parameters like number
I am working on a large project that involves taking thousands (30,000+) static web
I'm working on a CMS that fetches a user's profile image from their Facebook
I am working on a Web CMS. When the user clicks on a link
I'm working on a web application in Codeigniter. I'd like to integrate the functionality
I am working on a webapp that contains the basic elements of a CMS
I am working on building a search-engine friendly CMS. I know that perhaps one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.