News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[FREE] Add youtube video below header

Started by yogesh_gamer, May 27, 2011, 01:32:40 PM

Previous topic - Next topic

yogesh_gamer

Message:
QuoteI want to add youtube video below header.

Version
QuoteI am using 1.1.13 version. But the feature i want is not available for any version.

Disciption:
QuoteI want to add youtube video below header. I know i can do  that by editing Board Index file. But i want to change the video every day or hour. So editing is not a good idea. So i wanted a new mod for that.

Permissions
QuoteEveryone may use this feature. Because its just a video which i wanted to share.

Feature Set
QuoteAdmin Option.




Suki

try this:

./Themes/default/BoardIndex.template.php
Code (find) Select

// Show the news fader?  (assuming there are things to show...)


Code (replace) Select


if (!empty($modSettings['youtube_view']) && !empty($modSettings['youtube_view_enable']))
echo '
<table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 2ex;">
<tr>
<td class="catbg"></td>
</tr>
<tr>
<td valign="middle" align="center" height="60">
',$modSettings['youtube_view'],'
</td>
</tr>
</table>';


// Show the news fader?  (assuming there are things to show...)



./Sources/ModSettings.php
Code (find) Select


// Basic stuff, user languages, titles, flash, permissions...



Code (replace) Select


// Basic stuff, user languages, titles, flash, permissions...
array('check', 'youtube_view_enable'),
array('large_text', 'youtube_view', '6" style="width:95%'),



./Themes/default/languages/Modifications.english.php
Code (find) Select

?>



Code (Add before) Select


// Youtube view
$txt['youtube_view'] = 'Place your Custom youtube video code Here:';
$txt['youtube_view_enable'] = 'Turn on the  youtube view mod';




Now you only need to go to your admin / modifications  menu an change your youtube video  from there
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer

i think i m using english utf-8
so i need to edit that file instead of english.
am i right?

Suki

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer

#4
done.
i posted my problem in Support page. But there was no answer.
you can make this a mod for automatic installation.

Thanks
:)

Update:
i forget to mention that i want to add news (text) side by side.
Left Hand side Video and right hand side News/text

Suki

as you can see, I'm using a table to show the video, you could add another column to add your news in the right side.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer


Suki

like this:


if (!empty($modSettings['youtube_view']) && !empty($modSettings['youtube_view_enable']))
echo '
<table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 2ex;">
<tr>
<td class="catbg"></td>
</tr>
<tr>
<td valign="middle" align="center" height="60">
',$modSettings['youtube_view'],'
</td>
<td>  my news/ text</td>
</tr>
</table>';




you probably want to add another field on  /Sources/ModSettings.php  too, check the example I gave above.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer

#8
should i remove the previous code?
which you mentioned above
and where to put the code?

yogesh_gamer

i paste the code.
but there is no option for news in admin area

Suki

thats because it doesn't have any  admin section for the news, as I said in my previous post you must add your news/text  to Modsettings.php like the example above and most important, you really should have told me this from the beginning that way I could added the news from the start.


.Sources/ModSettings.php

Code (find) Select

// Basic stuff, user languages, titles, flash, permissions...
array('check', 'youtube_view_enable'),
array('large_text', 'youtube_view', '6" style="width:95%'),




Code (replace) Select

// Basic stuff, user languages, titles, flash, permissions...
array('check', 'youtube_view_enable'),
array('large_text', 'youtube_view', '6" style="width:95%'),
                           array('large_text', 'youtube_news', '6" style="width:95%'),






/Themes/languages/Modifications.english.php


Code (find) Select

// Youtube view
$txt['youtube_view'] = 'Place your Custom youtube video code Here:';
$txt['youtube_view_enable'] = 'Turn on the  youtube view mod';


Code (replace) Select

// Youtube view
$txt['youtube_view'] = 'Place your Custom youtube video code Here:';
$txt['youtube_view_enable'] = 'Turn on the  youtube view mod';
$txt['youtube_news'] = 'Place your Custom news Here:';





./Themes/default/BoardIndex.template.php

Code (find) Select

if (!empty($modSettings['youtube_view']) && !empty($modSettings['youtube_view_enable']))
echo '
<table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 2ex;">
<tr>
<td class="catbg"></td>
</tr>
<tr>
<td valign="middle" align="center" height="60">
',$modSettings['youtube_view'],'
</td>
<td>  my news/ text</td>
</tr>
</table>';


Code (replace) Select

if (!empty($modSettings['youtube_view']) && !empty($modSettings['youtube_view_enable']))
echo '
<table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 2ex;">
<tr>
<td class="catbg"></td>
</tr>
<tr>
<td valign="middle" align="center" height="60">
',$modSettings['youtube_view'],'
</td>
<td> ',$modSettings['youtube_news'],'</td>
</tr>
</table>';
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer

is there any need to remove the previous code?

Suki

If you pay attention  I use "find"    and "replace"  in the code box,  you need to follow those instructions, find the respective code in your files and replace it.


Basically you will replace your existing code with new one to add your news option.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer

But there are some problem related to space.
When i enter:
some text
some text
a
b


Its showing me
some text sometext a b

update:
and how to add URL to this news column


Its showing in one line.
I want to publish text as i enter

Suki

./Themes/default/BoardIndex.template.php


Code (find) Select

<td> ',$modSettings['youtube_news'],'</td>



Code (replace) Select


<td> ',nl2br($modSettings['youtube_news'], false),'</td>

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer

Quote from: Miss All Sunday on May 30, 2011, 12:59:55 PM
./Themes/default/BoardIndex.template.php


Code (find) Select

<td> ',$modSettings['youtube_news'],'</td>



Code (replace) Select


<td> ',nl2br($modSettings['youtube_news'], false),'</td>


hey there is no
<td> ',$modSettings['youtube_news'],'</td>
so, where to paste the code

Suki

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

yogesh_gamer

mam mam
please i know you are busy.
just explain me in details.
all step by step
please please

Suki

Attach your ./Themes/default/BoardIndex.template.php file.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.


Advertisement: