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

  • SEARCH
  • Home
  • 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 6019211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:23:17+00:00 2026-05-23T03:23:17+00:00

I have a basic class that I extend fairly often. I thought it would

  • 0

I have a basic class that I extend fairly often. I thought it would be nice to add a template of the extension as a choice when creating a new file. I went to Eclipse->Preferences->PHP->Code Style->Code Templates and decided to copy and modify the “Simple php file”. So I exported that template and opened it up. It looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
    <template autoinsert="true" context="php_new_file_context"
        deleted="false" description="Simple php file" enabled="true"
        id="org.eclipse.php.ui.editor.templates.php.author" name="New simple PHP file">
    &lt;?php
            ${cursor}
    ?&gt;
    </template>
</templates>

I edited the file to look like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
    <template autoinsert="true" context="php_new_file_context"
        deleted="false" description="PHP Item subclass file" enabled="true"
        id="org.eclipse.php.ui.editor.templates.php.itemclass" name="Item subclass file">
        &lt;?php
        /**
        * ${enter description}
        * @author: My Name
        * @version: 
        **/
        class ${classname} extends Item {
            const PKEY='${pkey}'; //name of primary key variable
            const TABLE='${table}'; //name of db table

            //db table vars
            $${pkey};
            $${name};

            //history vars


            public static function who() {
                return __CLASS__;
            }

        }
        ?&gt;
    </template>
</templates>

Then I saved it as item.xml and tried to import it. The import threw no errors, but the new template didn’t show up in the list. The only thing I can think is that the string I chose for the id attribute is problematic. But I can’t find any references on properly authoring a template. Either my google-fu is failing, or I’m trying to do something I’m not supposed to; I don’t know.

Ideas?

  • 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-23T03:23:18+00:00Added an answer on May 23, 2026 at 3:23 am

    The problem you have here is that there is an space in the name of a variable the third line of the template, ${enter description} and this isn’t allowed by eclipse, but those variables won’t be considered for autofilling.

    Even though, it’ll not let you import them, because it’s a feature that is no longer supported, as stated in their bugtracker. You could use the current templating system, wich will let you add variables to autofill. To use it, you have to go to PHP > Editor > Templates. Then, you’d create a new template with wichever name you want, and when you started typing it on a new php file, if you’d select it from the auto-complete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a basic ruby class: class LogEntry end and what i would like
I have an abstract base class that many classes extend. I'd like all these
I have a basic form with controls that are databound to an object implementing
I have a basic CRUD form that uses PageMethods to update the user details,
I have a basic ActiveRecord model in which i have two fields that i
I have a basic C# console application that reads a text file (CSV format)
I have some classes that are used as Singletons. They share some basic functionality
I'm getting started with django and I'd like to extend the basic django.contrib.auth.models.User class
I have an existing application in C++ with a custom ArrayBase class that manages
I have a number of UserControls that I want to each have some basic

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.