Advertisement:

Author Topic: Smf user Menu Beta Mod  (Read 20965 times)

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #20 on: August 11, 2009, 08:38:56 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

Code: [Select]
// 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #21 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)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #22 on: August 11, 2009, 08:53:23 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #23 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)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #24 on: August 11, 2009, 08:59:20 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #25 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');">
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #26 on: August 11, 2009, 09:03:45 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #27 on: August 11, 2009, 09:04:47 AM »
The message id prefixed with 'profile' should be fine.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #28 on: August 11, 2009, 09:09:30 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

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #29 on: August 11, 2009, 04:49:16 PM »
okay added the message ID, just need to check thats its fine, then will be ready to package

Code: [Select]
<!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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #30 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #31 on: August 11, 2009, 04:59:05 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #32 on: August 11, 2009, 05:02:11 PM »
Then I see nothing obviously wrong with it.

Package it and test it :)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #33 on: August 11, 2009, 05:04:25 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #34 on: August 11, 2009, 05:11:09 PM »
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)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #35 on: August 11, 2009, 05:26:41 PM »
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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #36 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Faevilangel

  • Jr. Member
  • **
  • Posts: 231
    • Gareth Gillman Freelacing
Re: adding menu to the display.template / display.php
« Reply #37 on: August 11, 2009, 06:14:17 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

Online Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,440
  • Master of BBC Abuse
Re: adding menu to the display.template / display.php
« Reply #38 on: August 11, 2009, 06:16:23 PM »
They can copy the file over though. For sorting a custom theme that is easier than doing manual edits.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,383
    • StoryBB/StoryBB on GitHub
Re: adding menu to the display.template / display.php
« Reply #39 on: August 11, 2009, 06:18:32 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.