question about creating templates

Started by Chen Zhen, October 16, 2010, 03:13:39 PM

Previous topic - Next topic

Chen Zhen

Just a question regarding current smf setup for creating templates without the header/footer.

I was able to do this easily enough after playing around with it a bit (for popup display) but I was wondering if there is an existing $context setting (or other) that allows for only displaying the template without the header and footer using the loadTemplate function?
For some page displays, having the header/footer (menu bar, logout, welcome, shutdown, etc.) is not needed/wanted.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Oya

either set $context['template_layers'] to array() or just have your function output what it needs to output and call obexit(false) like the XML stuff does

Chen Zhen

#2
Quote from: Oya on October 16, 2010, 03:32:51 PM
either set $context['template_layers'] to array() or just have your function output what it needs to output and call obexit(false) like the XML stuff does




I am not sure if you understand me exactly. (or vice-versa  ???)

I know to set:

$context['template_layers'] = array();

... and then create my html page in a function with theme css specs in the head and such..

What I am asking is if there is an existing setting to make this setup easier. Something that displays the proper html head specs (such as css theme style) and then displays what I put in a template file (<-- specifically as per current SMF protocol) without the header/footer info.

ie.

$context['no-show_header'] = true;


then in the SSI something that checks that and does not output the header/footer when I use the loadTemplate function.

I am asking if there is a general setup for this already?

currently, I do something like  this :

$context['template_layers'] = array();
$context['sub_template'] = 'My_Function';
$context['page_title'] = 'My Page Title";
$context['linktree'][] = array(
                                               'url' => $scripturl . '?action=whatever',
                       'name' => $context['name'],
                            );

return;


then create a function in the same file... for this example:

function template_My_Function()
{
... html page code... including javascript css theme style attributes in the <head>
}


... or maybe to be more SMF compliant, I fill $context variables with the data I need and manually load my own template type file from Themes/default within the above function.

... my question is.. is there an existing way to do this without having to keep echoing the <head> code (containing css attributes) every time like when using the loadTemplate function.



My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Oya

QuoteWhat I am asking is if there is an existing setting to make this setup easier. Something that displays the proper html head specs (such as css theme style) and then displays what I put in a template file (<-- specifically as per current SMF protocol) without the header/footer info.

ah that wasn't clear

just use $context['template_layers'] = array('html'); then since it's split into two layers for this reason

Chen Zhen

Quote from: Oya on October 16, 2010, 05:57:03 PM
just use $context['template_layers'] = array('html'); then since it's split into two layers for this reason

This does not omit the header/footer (menu bar, logout, welcome, shutdown, etc.).




My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Oya

it should do in a properly constructed theme

look at template_html_above and template_body_above in index.template.php - the template_html_above ENDS with opening the <body> tag which means the end of physical headers and no header which is in the body

if you're getting that still it means it's not overriding it properly or you have a theme that is not using proper 2.0 structure

Chen Zhen

Actually after messing with it, I find:


obexit(false);


... just gives me a blank white page no matter what. lol.

and..


$context['template_layers'] = array('html');


omits the header and footer.. yes.. but it gives a warning/error message because of the missing copyright in the footer.
ok.. no probs.. I understand the footer is necessary, but the header is not.
Yet, with the current smf template setup it appears I am forced to display the header also. (which contains no copyright)

I'll just stick with how I am doing it I suppose. And manually add the footer to my own html page if necessary to conform to smf specs/copyright law.

I was just curious to see if there was a pre-existing setup for not displaying the header at the top of the page.
Imao - the title, buttons, avatar, etc.. are not wanted/needed for display in some instances. There should really be a quick variable setting to have that not display so one does not have to create the whole html page every time... but cut and paste for a basic setup is fairly easy I suppose.




My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Oya

very rarely are you going to be creating an html page within smf itself that isn't using the theme

you can actually do it with loading ssi.php, changing the layers there and calling it which is what i do, where that doesnt show the copyright but pages that do use their own code do actually manage it entirely themselves (e.g. Help.php, helpadmin() for the help popups)

what you're doing is not normal within how smf works so smf makes no provision for it

Chen Zhen

#8
Quote from: Oya on October 16, 2010, 07:32:17 PM
very rarely are you going to be creating an html page within smf itself that isn't using the theme

The html head code that I write in my basic setup includes the necessary javascript css style attributes for the current theme.
Just no header. I wrote a mod that called for this and is why I am curious (game-in-post).

So I take it the answer to my question is 'no'.

Thanks for the info.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Advertisement: