Results 1 to 11 of 11

Thread: [SOLVED] Modify core files the safe way

  1. #1
    New user Ling's Avatar
    Join Date
    06-30-09.
    Location
    Villingen, Germany
    Posts
    19

    Default [SOLVED] Modify core files the safe way

    Hey,

    is there a way to safe core files safely.
    In my case I want to extend the items in nav.tpl so that I can use the ids ( not only the href and stuff ) of the pages also.

    I created a folder called "x_Custom" in system/moudules and inserted my modded Module.php there.

    But TL only gets it when I hack Module.php in system/modules/frontend directly.

    Any solutions for this?

    Thx in advance :)

  2. #2
    User fbliss's Avatar
    Join Date
    06-19-09.
    Location
    Greenfield, MA
    Posts
    50

    Default Re: Modify core files the safe way

    Hi Ling,

    so, are you trying to set IDs for the purpose of running a custom menu script/plugin? I ask because there may be a better way to accomplish your task without modifying core files.

    Take care,

    Fred

  3. #3
    User
    Join Date
    08-07-09.
    Location
    Kent, United Kingdom
    Posts
    92

    Default Re: Modify core files the safe way

    To modify a template I've used:
    Code:
    //Store the existing template and create our new one
    $old_template=$this->Template;		
    $this->strTemplate = 'new_template; //NEEDS ADDITIONAL WORK to read from DB (if required)
    $this->Template = new Template($this->strTemplate);
    
    // Get the existing template information and assign to our new template
    $t_array = (array)($old_template);	
    $val=chr(0).chr(42).chr(0).chr(97).chr(114).chr(114).chr(68).chr(97).chr(116).chr(97);		
    foreach($t_array[$val] as $key=>$val)
    			$this->Template->$key=$val;
    I need to investigate this a bit further since I'm not exactly happy with the character hack but this does work without touching any core files.

    A side note, I would suggest all devs to NEVER modify core files. It's hell to reverse, there are plenty of methods around having to modify core files.

  4. #4
    New user
    Join Date
    09-07-09.
    Posts
    4

    Default Re: Modify core files the safe way

    thanks for advice

  5. #5
    New user Ling's Avatar
    Join Date
    06-30-09.
    Location
    Villingen, Germany
    Posts
    19

    Default Re: Modify core files the safe way

    Sorry, I was on vacation :)

    @ fbliss: Exactly :) I wanted to get some page ids, but didn't found a method I could use without writing a whole extension.

  6. #6
    User
    Join Date
    08-07-09.
    Location
    Kent, United Kingdom
    Posts
    92

    Default Re: Modify core files the safe way

    Quote Originally Posted by Ling
    Sorry, I was on vacation

    @ fbliss: Exactly I wanted to get some page ids, but didn't found a method I could use without writing a whole extension.
    Hi Ling, Welcome back.

    If you could explain a bit more about what you are trying to achieve?
    I assume you have a template that you are over-riding with your custom one and you want to gain page id's onto that?

  7. #7
    New user Ling's Avatar
    Join Date
    06-30-09.
    Location
    Villingen, Germany
    Posts
    19

    Default Re: Modify core files the safe way

    Hi,

    I'm trying to get get the page ids of the pages in the navigation to get some more information out of the DB.
    I want to use that additional info in the navigation itself (A special articel with a picture as CE to be shown in the navigation).

  8. #8
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Modify core files the safe way

    Insert tags no good to you?
    Just in case you're not aware of them...
    http://www.typolight.org/insert-tags.html
    {{env:age_id}} This tag will be replaced with the ID of the current page.

  9. #9
    New user Ling's Avatar
    Join Date
    06-30-09.
    Location
    Villingen, Germany
    Posts
    19

    Default Re: Modify core files the safe way

    I need these ids in the navigation template.
    The ids I need are the the ones of the pages linked in the single navigation points.

  10. #10
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Modify core files the safe way

    Theres some info here (i think its new) about customisation....
    http://www.typolight.org/customizing-typolight.html
    I haven't read it yet, but at a glance it may assist....

  11. #11
    New user Ling's Avatar
    Join Date
    06-30-09.
    Location
    Villingen, Germany
    Posts
    19

    Default Re: Modify core files the safe way

    Thank you :)
    This one: http://www.typolight.org/overriding-class-methods.html seems to be the thing I'm searching for...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •