News:

Join the Facebook Fan Page.

Main Menu

Embeding Code Issue

Started by Ozysites, April 12, 2010, 09:03:12 AM

Previous topic - Next topic

Ozysites

hello

I have installed a chat feature and I need to embed a code in  index.template.php  just above This code here
------------------------------
else
     echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
     '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
     . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
     . '" style="margin: 2px 0;" border="0" />' : $txt[108]),    '</a>';
---------------------------------

But I cannot find this code in that file.

Can anyone please tell me the eqivilent code to this in the index.template.php file please.

Thank You
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

Hi, that looks like the code for a logout button.

However since you are using SMF 2.0 the place to look is Subs.php. Is that code from the mod and is it 2.0 compatible?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hi

This code is to place a chatbox button next to the LogOut Button.

The code above I showed you is the code that the intergration document for this chat feature said it went with smf system to be able to place that chatbox button there.

If that will do the same thing in the sub.php file then I will place it there.

Cheers
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

For 2.0 the buttons are now steup in an array and totally differently. Look for function setupMenuContext()


If it confuses you on how it's done. Post the code for that button for 1.x

Is this mod/integration compatible with SMF 2.0?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hi

Yes it it is FlashChat which allows during installation with smf version 2.0 specifically allowing me to use my same already members of the forum once they log in.

This is how I got the code.
-------------------------------------


Open index.template.php, and find the following text:

else
     echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
     '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
     . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
     . '" style="margin: 2px 0;" border="0" />' : $txt[108]),    '</a>';
Replace it with:
else {
     echo '<a href="', $GLOBALS['boardurl'], '/chat/flashchat.php">',
     ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
     . '/chat_icon.gif" alt="FlashChat" style="margin: 2px 0;"
     border="0" />' : "FlashChat"),'</a>';

    echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
    '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
    . '" style="margin: 2px 0;" border="0" />' : $txt[108]),'</a>';
}

---------------------------------------------------

I have attached a copy of my index.template.php

Cheers
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

I didn't need that. All I wanted to see what the code for the chat button looks like. Are you sure you've got the 2.0 version of the mod?

In Sources/Subs.php look for:

'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',


and add the following before it.


'chat' => array(
'title' => 'FlashChat',
'href' => $GLOBALS['boardurl'], '/chat/flashchat.php',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
),

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hello

I think you are having me place this next to the registerlink making it available to none members.

It needs to be next to the logout link so that only members can use it.

can can tell me what to look for there please.

thank you
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

No, that is setup not to show for guest.


'show' => !$user_info['is_guest']


The ! means "not". So if the user is not a guest, show the button.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hi

This is what I have done which is where it should be and looks good.

---------------------------
),
                        'chat' => array(            
                                   'title' => 'FlashChat',            
                                   'href' => $GLOBALS['boardurl'], '/chat/flashchat.php',            
                                   'show' => !$user_info['is_guest'],            
                                   'sub_buttons' => array(            
                                   ),         
                        ),

         'register' => array(
            'title' => $txt['register'],
            'href' => $scripturl . '?action=register',
            'show' => $user_info['is_guest'],
            'sub_buttons' => array(
            ),
            'is_last' => !$context['right_to_left'],
         ),
---------------------------------------------

BUT when I click on it , it logs me out instead of opening a new window to run the chatbox.

Is there something missing ?

Cheers
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

You need to add target="_blank to the href


'href' => $GLOBALS['boardurl'], '/chat/flashchat.php" target="_blank', 


If you want to get fancy, download my member notepad mod. (link below my sig) and see how it's done there. There I have it open either in a new tab or window depending on browser. Or in a sized pop-up window.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hello

I have done this and I ma still being logged out instead of a new window opening.

Any other ideas please.

Cheers
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

Can you attach Subs.php to a post please.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hello

I am having problems with the whole forum always logging me out everytime I save something or do different things within the Admin Panel, I spend more time Logging in than doing anything else.

I would presume that this maybe what is affecting the chat feature as well.

Here is the file you requested.

I also saw that in the Modify Theme Templales within the Admin that some files cannot ne opened like index.templates.htm and some others.

Would you have any suggestions as to why about any of the above please.

thank you
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

Try this file.

Can't hep with theme edit problem as I don't edit files that way..

For the login problem go into the Admin CP> Server Settings > Feature Configuration and set the following:

Enable local storage of cookies - unchecked
Use subdomain independent cookies - checked
Use database driven sessions - checked

Also check the login time length.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hello

Thank You for the file update.

Not sure what your saying about the theme as I never brought this topic up.

I did as you suggested with the cookies and it seems to be working fine as I am not being logged out anymore.

The Chat box comes up in new window which is great. I think there is an error with the actual chat program as it loads but no chat box appers. I will have it sorted out soon I hope.

Thank you for your help.

Cheers

Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

Maybe I misunderstood this:

Quote
I also saw that in the Modify Theme Templales within the Admin that some files cannot ne opened like index.templates.htm and some others.

QuoteThe Chat box comes up in new window which is great. I think there is an error with the actual chat program as it loads but no chat box appers. I will have it sorted out soon I hope.

Are you sure that you are using the version of the mod for 2.0.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

Hi

Maybe I didn't explain myself properly, so here goes,,lol

I Admin panel, Themes and Layout , Modify Themes , and then click on "Browse the templates and files in this theme" which opens up a list of files that we can edit from there. That list of files are live which opens that file up. When I first install 2.0rc3 version they where all clickable, NOW about half are no longer clickable meaning I cannot open them to make changes.

Question is how do I make the none live links LIVE please if at all possible.

I hope I have better explained myself.

Cheers
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

It could be a permissions thing. FTP into your site and check the permissions on them.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Ozysites

#18
I just changed one's permission and it works in Admin now so you where correct it was a permissions problem.

Thank You

This hopfully solves all Issues on this topic I hope and I thank you again for your time and help.

Cheers
Be kind and respect others opinons at all times.  http://www.ozyforums.com.au

Kays

Glad to here that. :)

I'll mark this as solved then.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: