[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 :)
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
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.
Re: Modify core files the safe way
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.
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?
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).
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
Quote:
{{env::page_id}} This tag will be replaced with the ID of the current page.
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.
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....
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...