News:

Wondering if this will always be free?  See why free is better.

Main Menu

Smf user Menu Beta Mod

Started by Faevilangel, August 11, 2009, 07:02:08 AM

Previous topic - Next topic

Faevilangel

arantor is probably best for answering this as he has helped me get the menu working

how would i include the menu (js) into the display.template.php OR the display.php file ?

i currently have the js set as an external function but im guessing im going to need to make it inline
I am available for theme work, pm me for info

Arantor

If it's a big function, drop it into some of the JS that's floating about, generally by tacking it on the end of the JS normally loaded.

If it's not such a big function, inlining it is doable. If it's the script I think you're on about, it relies on an HTML fragment being in the document. Is that fragment being moved to wherever necessary on the page in order to work?

Faevilangel

Quote from: Arantor on August 11, 2009, 07:07:20 AM
If it's a big function, drop it into some of the JS that's floating about, generally by tacking it on the end of the JS normally loaded.

If it's not such a big function, inlining it is doable. If it's the script I think you're on about, it relies on an HTML fragment being in the document. Is that fragment being moved to wherever necessary on the page in order to work?

yeah i will "remove" the link to the username and insert my own code, all the css will be added to the style.css

The thing is could the js be tacked onto the other js when the mod is installed ?

i know very little about the mod building process, but i know its done via an xml file that you tell the script to remove xx and replace with xxx
I am available for theme work, pm me for info

Antechinus

Just a warning, guys. For RC2 all the inline js is being moved out to separate files. ;)

I'd be inclined to call your own file, or add it to an external file that is already in SMF (at least if you're doing this for 2.0).

Faevilangel

Quote from: Antechinus on August 11, 2009, 07:21:30 AM
Just a warning, guys. For RC2 all the inline js is being moved out to separate files. ;)

i have made this for 1.1 at the moment, but once i got that working then will see about moving it to rc2
I am available for theme work, pm me for info

Arantor

You can not only search/replace but add new content to the end of the file too. That reminds me, I am in the middle of writing a 'how to package a mod'.

The problem I see is that you have an HTML block that isn't being dynamically added - or is it? If it is being dynamically added, you could almost inline it.


Antechinus: thanks. We're discussing a possible mod, though, and I can see why you would encourage keeping inline scripts out of core even for mods.

Faevilangel

Quote from: Arantor on August 11, 2009, 07:23:09 AM

The problem I see is that you have an HTML block that isn't being dynamically added - or is it? If it is being dynamically added, you could almost inline it.

in what way  ??? you have lost me  :P
I am available for theme work, pm me for info

Arantor

In your menu, you have a <DIV> and some <A> tags.

When it is being added? Are you added it in JS when the user clicks on the profile, or is it already there in the HTML, just waiting to be displayed?

Faevilangel

Quote from: Arantor on August 11, 2009, 07:32:28 AM
In your menu, you have a <DIV> and some <A> tags.

When it is being added? Are you added it in JS when the user clicks on the profile, or is it already there in the HTML, just waiting to be displayed?

ah right, its already in the html, the js just changes the display attribute from  none to block
I am available for theme work, pm me for info

Arantor

Is it in the HTML once total, or once per user?

Faevilangel

the menu can be hidden and shown any number of times, i have a working example at www.garethgillman.co.uk/menu.html
I am available for theme work, pm me for info

Arantor

You've missed my point.

Is it only a single instance of HTML on the page in total?

Faevilangel

Quote from: Arantor on August 11, 2009, 07:41:55 AM
You've missed my point.

Is it only a single instance of HTML on the page in total?

yeah just once
I am available for theme work, pm me for info

Arantor

Are you repositioning the <DIV> in the Javascript then?

Faevilangel

Quote from: Arantor on August 11, 2009, 07:46:24 AM
Are you repositioning the <DIV> in the Javascript then?

no its done with css, the js only shows / hides the menu
I am available for theme work, pm me for info

Arantor

How are you repositioning the menu then? Surely you have no control where the user will be on the page when they come to click this? (NB I'm assuming this is aiming for the thread display, where it will easily be more than a screen's height)

Faevilangel

the div will be positioned right below the link, so when the link is clicked, it shows the menu right below the link
I am available for theme work, pm me for info

Arantor

So if you only have 1 menu in the whole page, how are you positioning it?

Faevilangel

Quote from: Arantor on August 11, 2009, 08:06:24 AM
So if you only have 1 menu in the whole page, how are you positioning it?
there isn't 1 menu, the html code is only inputted once, when the link to the poster is made, it *should* generate the menu bar below it too

it automatically grabs the users name, etc then shows the menu below the link when clicked

unless smf runs different to how i would want it implemented

I am available for theme work, pm me for info

Arantor

I think the fundamental question is where is the HTML being added to the page? (This isn't an SMF problem, this is an HTML problem)

Advertisement: