News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Smf user Menu Beta Mod

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

Previous topic - Next topic

Faevilangel

Quote from: Arantor on August 11, 2009, 08:31:38 AM
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)

in display.template.php


// Show information about the poster of this message.
echo '
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
<b>', link here, '</b><br /> <div here >
<div class="smalltext">';



I am available for theme work, pm me for info

Arantor

So you're adding it under every poster, that's what I was getting at.

Question: are you assigning unique ids to each one? If not, you'll get multiple boxes displayed on click (or none at all)

Faevilangel

Quote from: Arantor on August 11, 2009, 08:50:42 AM
So you're adding it under every poster, that's what I was getting at.

Question: are you assigning unique ids to each one? If not, you'll get multiple boxes displayed on click (or none at all)
my explanations aren't very good eh.... im not very good with wording (even tho english is my native tongue)

how would i add that .... in the div or the js ? i know in the div i could add change the css to a class then have the div id as a unique id, could i insert the message id as the unique id ?
I am available for theme work, pm me for info

Arantor

You'd have to add a unique id to the div, then make sure that id is passed to the JS when you call for the item to be hidden/expanded.

You can use the message id, but I'd prefix it with something unique, other than say msg (as msg[post number] is already in use)

Faevilangel

Quote from: Arantor on August 11, 2009, 08:55:32 AM
You'd have to add a unique id to the div, then make sure that id is passed to the JS when you call for the item to be hidden/expanded.

You can use the message id, but I'd prefix it with something unique, other than say msg (as msg[post number] is already in use)

okay, what do you suggest ? you lost me on the js again, how would i include the unique id into the js ? php ?
I am available for theme work, pm me for info

Arantor

No, you include the unique id in the div, then in the JS function you call from the onclick, you include it there.

E.g. <div onclick="javascript:myfunction('unique_id');">

Faevilangel

Quote from: Arantor on August 11, 2009, 09:00:59 AM
No, you include the unique id in the div, then in the JS function you call from the onclick, you include it there.

E.g. <div onclick="javascript:myfunction('unique_id');">

ahh thanks, what do you suggest as the unique id ?
I am available for theme work, pm me for info

Arantor

The message id prefixed with 'profile' should be fine.

Faevilangel

Quote from: Arantor on August 11, 2009, 09:04:47 AM
The message id prefixed with 'profile' should be fine.

i gotta go to work so will get onto this later, and maybe have time to get it modded up  :D
I am available for theme work, pm me for info

Faevilangel

okay added the message ID, just need to check thats its fine, then will be ready to package


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<link rel="stylesheet" type="text/css" href="style_menu.css" />
<script type="text/javascript">
function profile_menu() {
  var d = document.getElementById(' ',$message['id'],' ');
  if(d.style.display == 'none') {
    d.style.display = 'block';
  } else {
    d.style.display = 'none';
  }
}
</script>
</head>
<body>
<a href="#" onclick="profile_menu(); return false;">',$message['member']['name'],'</a>

<div class="menu" id="',$message['id'],'">
<ul id="menu2">
<li><a href="', $scripturl, '?action=profile;u=',$context['member']['id'],'">View Profile</a></li>
<li><a href="', $scripturl, '?action=pm;sa=send;u=', $context['member']['id'], '">Send Mesage</a></li>
<li><a href="', $scripturl, '?action=buddy;u=', $context['member']['id'], ';sesc=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a> </li>
</ul>
</div>
</body>
</html>
I am available for theme work, pm me for info

Arantor

And where are you adding that?

If you're adding that once per message, you're embedding a full HTML page inside another.

Faevilangel

Quote from: Arantor on August 11, 2009, 04:55:11 PM
And where are you adding that?

If you're adding that once per message, you're embedding a full HTML page inside another.

i won't display the full html, thats just so i can view it on my pc, i built it in a html page so i can play with the styling etc

the only bits being embedded will be the link, js and the div

I am available for theme work, pm me for info

Arantor

Then I see nothing obviously wrong with it.

Package it and test it :)

Faevilangel

Quote from: Arantor on August 11, 2009, 05:02:11 PM
Then I see nothing obviously wrong with it.

Package it and test it :)

ok here i go  :o
I am available for theme work, pm me for info

Arantor

If you need any help please do ask. Packaging your first mod is an interesting experience, and it's something I am meaning to write a guide on shortly (I have it half written already)

Faevilangel

stuck on adding the js, there is no js (that i can see) to tack onto the end, how would i add the js as inline, i know of adding functions but not the full code
I am available for theme work, pm me for info

Arantor

How about Themes/default/script.js for 1.1?

The problem you're going to have is providing support for this in mods because not all themes will have that file.

Faevilangel

Quote from: Arantor on August 11, 2009, 06:07:00 PM
How about Themes/default/script.js for 1.1?

The problem you're going to have is providing support for this in mods because not all themes will have that file.

good idea, yeah it might be  ::) couldn't they create the file script.js and add the code if needed ?
I am available for theme work, pm me for info

Antechinus

They can copy the file over though. For sorting a custom theme that is easier than doing manual edits.

Arantor

The thing is with that you've still got to load the script, meaning an edit to the custom theme's index.template.php.

My understanding was that script.js should be loaded regardless as it covers some of the core JS functionality in SMF.

Advertisement: