• Welcome to Simple Machines Community Forum. Please login or sign up.
December 03, 2021, 01:07:50 PM

News:

Follow SMF on Twitter.


Custom blocks

Started by davidhs, June 28, 2013, 03:02:05 PM

Previous topic - Next topic

davidhs

In default/index.template.php there are changes (I think was made by mod DevCenter and other with SEO).

If you want install on default theme you can:
1. Install on default theme with errors
2. Modify Themes/default/index.template.php. Replace (line 492 aprox.)

<ul class="reset">
<li class="copyright">', theme_copyright(), '</li>
';

if (!empty($modSettings['seo_enable_sitemap']))
echo'
<li><a href="', $scripturl, '?action=sitemap" title="', $txt['seo_sitemap'], '"><span>', $txt['seo_sitemap'], '</span></a></li>';

echo'
<li><a id="button_xhtml" href="http://validator.w3.org/check?uri=referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>', $txt['xhtml'], '</span></a></li>
', !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' . $scripturl . '?action=.xml;type=rss" class="new_win"><span>' . $txt['rss'] . '</span></a></li>' : '', '
<li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>
</ul>';


// DevCenter - Show load average.
if (!empty($modSettings['devcenter_displayserverload']))
echo '<p>', sprintf($txt['devcenter_load'], $context['dc_load'][0], $context['dc_load'][1], $context['dc_load'][2]), '</p>'; // Show the load time?
if ($context['show_load_time'])
echo '
<p>', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';

by

<!-- BEGIN MOD CustomBlocks -->';
if (!empty($context['cb_footer_above']))
echo $context['cb_footer_above'];
if (!empty($context['cb_footer']))
echo $context['cb_footer'];
else
{
echo '
<ul class="reset">
<li class="copyright">', theme_copyright(), '</li>
';

if (!empty($modSettings['seo_enable_sitemap']))
echo'
<li><a href="', $scripturl, '?action=sitemap" title="', $txt['seo_sitemap'], '"><span>', $txt['seo_sitemap'], '</span></a></li>';

echo'
<li><a id="button_xhtml" href="http://validator.w3.org/check?uri=referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>', $txt['xhtml'], '</span></a></li>
', !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' . $scripturl . '?action=.xml;type=rss" class="new_win"><span>' . $txt['rss'] . '</span></a></li>' : '', '
<li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>
</ul>';


// DevCenter - Show load average.
if (!empty($modSettings['devcenter_displayserverload']))
echo '<p>', sprintf($txt['devcenter_load'], $context['dc_load'][0], $context['dc_load'][1], $context['dc_load'][2]), '</p>'; // Show the load time?
if ($context['show_load_time'])
echo '
<p>', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';
}
if (!empty($context['cb_footer_below']))
echo $context['cb_footer_below'];
// END MOD CustomBlocks


If you want install on Aqua Style theme you can install and then modify Themes/Aqua/index.template.php.
1. Search (line 848)

<h1 class="forumtitle">

<a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="' . $settings['images_url'] . '/theme/logo.png" alt="' . $context['forum_name'] . '" />' : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>

</h1>

and replace by

<!-- BEGIN MOD CustomBlocks -->';
if (!empty($context['cb_header_above']))
echo $context['cb_header_above'];
if (!empty($context['cb_header']))
echo $context['cb_header'];
else
{
echo '
<h1 class="forumtitle">

<a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="' . $settings['images_url'] . '/theme/logo.png" alt="' . $context['forum_name'] . '" />' : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>

</h1>';
}
echo '
<!-- END MOD CustomBlocks -->


2. Search (line  620)

echo '

</div>

<br class="clear" />

', !empty($settings['forum_width']) ? '

</div>' : '';

and replace by

echo '

</div>

<br class="clear" />';

// BEGIN MOD CustomBlocks
if (!empty($context['cb_header_below']))
echo $context['cb_header_below'];
// END MOD CustomBlocks

echp !empty($settings['forum_width']) ? '

</div>' : '';


3. Search (line 723)

<ul class="reset">

<li class="copyright">', theme_copyright(), '</li>

<li class="copyright">', aqua_copy(), '</li>

';

if (!empty($modSettings['seo_enable_sitemap']))
echo'
<li><a href="', $scripturl, '?action=sitemap" title="', $txt['seo_sitemap'], '"><span>', $txt['seo_sitemap'], '</span></a></li>';

echo'
<li><a id="button_xhtml" href="http://validator.w3.org/check?uri=referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>', $txt['xhtml'], '</span></a></li>

', !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' . $scripturl . '?action=.xml;type=rss" class="new_win"><span>' . $txt['rss'] . '</span></a></li>' : '', '

<li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>

</ul>';




// DevCenter - Show load average.
if (!empty($modSettings['devcenter_displayserverload']))
echo '<p>', sprintf($txt['devcenter_load'], $context['dc_load'][0], $context['dc_load'][1], $context['dc_load'][2]), '</p>'; // Show the load time?

if ($context['show_load_time'])

echo '

<p>', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';

and replace by

<!-- BEGIN MOD CustomBlocks -->';
if (!empty($context['cb_footer_above']))
echo $context['cb_footer_above'];
if (!empty($context['cb_footer']))
echo $context['cb_footer'];
else
{
echo '
<ul class="reset">

<li class="copyright">', theme_copyright(), '</li>

<li class="copyright">', aqua_copy(), '</li>

';

if (!empty($modSettings['seo_enable_sitemap']))
echo'
<li><a href="', $scripturl, '?action=sitemap" title="', $txt['seo_sitemap'], '"><span>', $txt['seo_sitemap'], '</span></a></li>';

echo'
<li><a id="button_xhtml" href="http://validator.w3.org/check?uri=referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>', $txt['xhtml'], '</span></a></li>

', !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' . $scripturl . '?action=.xml;type=rss" class="new_win"><span>' . $txt['rss'] . '</span></a></li>' : '', '

<li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>

</ul>';




// DevCenter - Show load average.
if (!empty($modSettings['devcenter_displayserverload']))
echo '<p>', sprintf($txt['devcenter_load'], $context['dc_load'][0], $context['dc_load'][1], $context['dc_load'][2]), '</p>'; // Show the load time?

if ($context['show_load_time'])

echo '

<p>', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';
}
if (!empty($context['cb_footer_below']))
echo $context['cb_footer_below'];
// END MOD CustomBlocks


Warning: I have not tested these changes.

kamili34

Quote2. Search (line  620)

echo '

</div>

<br class="clear" />

', !empty($settings['forum_width']) ? '

</div>' : '';

and replace by

echo '

</div>

<br class="clear" />';

// BEGIN MOD CustomBlocks
if (!empty($context['cb_header_below']))
echo $context['cb_header_below'];
// END MOD CustomBlocks

echp !empty($settings['forum_width']) ? '

</div>' : '';


Got error only on this.


::)

davidhs

Quote from: kamili34 on February 20, 2014, 05:34:40 PM
Quote2. Search (line  620)

echo '

</div>

<br class="clear" />

', !empty($settings['forum_width']) ? '

</div>' : '';

and replace by

echo '

</div>

<br class="clear" />';

// BEGIN MOD CustomBlocks
if (!empty($context['cb_header_below']))
echo $context['cb_header_below'];
// END MOD CustomBlocks

echp !empty($settings['forum_width']) ? '

</div>' : '';


Got error only on this.


::)
:-[ I am sorry, it is a typo (echp --> echo)

[...]and replace by

echo '

</div>

<br class="clear" />';

// BEGIN MOD CustomBlocks
if (!empty($context['cb_header_below']))
echo $context['cb_header_below'];
// END MOD CustomBlocks

echo !empty($settings['forum_width']) ? '

</div>' : '';

kamili34

Great now time to test. :P


I will buy you a beer if I could. :D


Bluey

Hi

installed thsi mod on a fresh upgrade of 2.0.7 on a test forum. When I fill in the sample code as per you sample it get this error


Method Not Implemented

GET to /test/index.php not supported.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any ideas

davidhs

Quote from: Bluey on May 16, 2014, 03:55:22 AM
Hi

installed thsi mod on a fresh upgrade of 2.0.7 on a test forum. When I fill in the sample code as per you sample it get this error


Method Not Implemented

GET to /test/index.php not supported.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any ideas
Hi Bluey,

I do not known... I create all example blocks in my test forum 2.0.7 and works.

Perhaps you have a typo? Try create only one block type HTML with content "Test".

davidhs

New version:
2.3.1   2014-06-24
------------------
! Use HTML entities in ISO-8859-1 languages.
+ Functions to get/update/delete data check the parameters before using them.
* Big multi-line text input fields are wider.
* Submit buttons have shortcut key to get focus.
+ SMF compatibility: 2.0.8.

davidhs

New version:
2.3.2   2014-10-08
------------------
+ SMF 1.1.x: Implemented a generic form of displaying lists, similar to SMF 2.0.x.
+ SMF compatibility: 1.1.20 and 2.0.9.

MyTime

Could I use this mod too add a custom border images I have downloaded on my computer?

davidhs

Quote from: CannabisGamerClub on October 13, 2014, 08:28:09 PM
Could I use this mod too add a custom border images I have downloaded on my computer?
I do not understand what you want to do. Perhaps you need MOD BBCode with style http://custom.simplemachines.org/mods/index.php?mod=2505
Can you attach an example image?

arielvered

Hi,
I've installed this mod.
I can't figure out how to change a block. I've added a block above the header and decided that I want to put the block beneath the header instead.
I can't find where I can do this, or even edit the text that I've already put there.
Where do I do this?
Also, I'd love to add a picture to my block, I haven't found this option either.

Thanks very much,
Ariel

davidhs

Quote from: arielvered on October 26, 2014, 08:26:20 AM
I can't figure out how to change a block. I've added a block above the header and decided that I want to put the block beneath the header instead.
I can't find where I can do this, or even edit the text that I've already put there.
Where do I do this?
You can edit the text of the block with "Modify" option.
You can not move a block to other area (i.e. from header to above header). This can be an enhancement for next update ;)
Now you can only change the order of blocks in area.
Quote from: arielvered on October 26, 2014, 08:26:20 AM
Also, I'd love to add a picture to my block, I haven't found this option either.
Create a block like this:
Type HTML, content
...<img src="your_img_url">...
or type BBC, content
...[img]your_img_url[/img]...

arielvered

Thanks so much for your help.
I hope that I have attached the way it looks right now!

waplist

Not working giving error when installing
Even for curve theme plz fix it

davidhs

Quote from: waplist on December 01, 2014, 07:17:50 AM
Not working giving error when installing
Even for curve theme plz fix it
Can you attach images of screen with your install error, please?
What is your forum version?

waplist

Ok wait a minute .my veersion is 2.0.9
And i am using reseller theme


davidhs

Ok, I see your problem.

I am sorry, but this mod only can be installed on default theme (and perhaps in others very similars). :(

If you want install in other theme you can try a manual install.

davidhs

To moderators: Text to move to first post
QuoteSubject:
QuoteCustom blocks, 2.4 (SMF 1.1-1.1.21, 2.0-2.0.10)
Body:
Quote
Link to Mod




Custom blocks

ABOUT...

Custom blocks, 2.4
© 2013-2015 by davidhs
© Polish language 2014-2015 by FishingManMatt


This work is licensed under a Creative Commons Attribution 3.0 Unported License.

DESCRIPTION

Allows to show custom blocks:

  • Above the forum header.
  • Instead of default header of forum.
  • Below the forum header.
  • Above the forum footer.
  • Instead of default footer of forum.
  • Below the forum footer.

Can be define any number of blocks through several parameters:

  • Frame: HTML code with attributes for DIV tag which skirts the content of the block. If left empty is not put DIV tag. Through style or class attributes (CSS styles and classes) may indicate position, size and others characteristics of the block.
  • Type: A block can contain HTML code (the default option), BBC or PHP.
  • Content: Content of the block. Position, size and others characteristics of the block may be indicated here or in frame. Can be used the following variables:

    • {COPYRIGHT} - Copyright of the forum.
    • {BOARDURL} - URL to forum folder.
    • {SCRIPTURL} - Web address of forum.
    • {IMAGES_URL} - URL to the images folder in the users current theme.
    • {DEFAULT_IMAGES_URL} - URL to the images folder in the default theme.
    Variable {COPYRIGHT} must be on some block of forum footer. If it is not, will be create a block with the text of copyright.
  • Order: Position of the block in relation to the other blocks from left to right.
  • Permissions: Indicates the user group that can see the block. By default none.
  • Active: Indicates if a block is active. By default active.

     

EXAMPLE

QuoteBlocks above the forum header


Frame: style="height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block above the header[/size] [color=red]- Block above the header - Block above the header[/color]
Order: 1
Permissions: Guest:View, User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Blocks in the forum header


Frame: style="float: left; width: 250px; height: 50px; border: 5px solid red;"
Type: HTML
Content: <span style="font-size: 12pt;">Block header 1</span> <span style="color: red;">- Block header 1 - Block header 1</span>
Order: 1
Permissions: User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Frame: style="float: left; width: 10%; height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block header 2[/size] [color=red]- Block header 2[/color]
Order: 2
Permissions: User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Frame: style="float: center; height: 50px; border: 5px solid red;"
Type: PHP
Content: $bl = 'Block header 3';
echo '<span style="font-size: 12pt;">', $bl, '</span> <span style="color: red;">- ', $bl, ' - ', $bl, '</span>';

Order: 4
Permissions: User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Frame: style="float: right; width: 150px; height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block header 4[/size] [color=red]- Block header 4[/color]
Order: 3
Permissions: User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Frame: style="height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block header guest[/size] [color=red]- Block header guest - Block header guest[/color]
Order: 1
Permissions: Guest:View
Active: Yes


Blocks below the forum header


Frame: style="height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block below the header[/size] [color=red]- Block below the header - Block below the header[/color]
Order: 1
Permissions: Guest:View, User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Blocks above the forum footer


Frame: style="height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block above the footer[/size] [color=red]- Block above the footer - Block above the footer[/color]
Order: 1
Permissions: Guest:View, User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Blocks in the forum footer


Frame: style="float: left; width: 33%; height: 50px; border: 5px solid red;"
Type: HTML
Content: <span style="font-size: 12pt;">Block footer all</span> <span style="color: red;">- Block footer all - Block footer all</span>
Order: 1
Permissions: Guest:View, User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Frame: style="float: right; width: 50%; height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block footer user[/size] [color=red]- Block footer user - Block footer user[/color]
{COPYRIGHT}

Order: 2
Permissions: User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes


Frame: style="float: right; width: 200px; height: 50px; border: 5px solid red;"
Type: PHP
Content: $bl = 'Block footer guest';
echo '<span style="font-size: 12pt;">', $bl, '</span> <span style="color: red;">- ', $bl, ' - ', $bl, '</span>';

Order: 2
Permissions: Guest:View
Active: Yes


Blocks below the forum footer


Frame: style="height: 50px; border: 5px solid red;"
Type: BBC
Content: [size=12pt]Block below the footer[/size] [color=red]- Block below the footer - Block below the footer[/color]
Order: 1
Permissions: Guest:View, User:View, Local moderator:View, Global moderator:View, Administrator:View
Active: Yes

Users, moderators and administrators see this:

Guests see this:

SMF COMPATIBILITY


  • SMF 1.1 to 1.1.21.
  • SMF 2.0 to 2.0.10.

LANGUAGES


  • english, english_british.
  • polish (incomplete).
  • spanish, spanish_es, spanish_latin.

If you want help translating it into other languages, you can add the translation in this topic.

DOWNLOAD

Link to MOD

MANUAL INSTALLATION

See http://wiki.simplemachines.org/smf/Manual_installation_of_mods

SUPPORT AND COMMENTS

In English: http://www.simplemachines.org/community/index.php?topic=506711.0
In Spanish: http://www.simplemachines.org/community/index.php?topic=503400.0

CHANGE LOG

Legend:   ! Fixed   + Added   - Removed   * Changed   @ Note

2.4     2015-05-15
------------------
+ Field in administration panel to edit the position of the block.
+ Languages: polish, polish-utf8, thanks to FishingManMatt.
+ SMF compatibility: 1.1.21 and 2.0.10.

2.3.2   2014-10-08
------------------
+ SMF 1.1.x: Implemented a generic form of displaying lists, similar to SMF 2.0.x.
+ SMF compatibility: 1.1.20 and 2.0.9.

2.3.1   2014-06-24
------------------
! Use HTML entities in ISO-8859-1 languages.
+ Functions to get/update/delete data check the parameters before using them.
* Big multi-line text input fields are wider.
* Submit buttons have shortcut key to get focus.
+ SMF compatibility: 2.0.8.

2.3     2014-01-25
------------------
+ Upgrade code to the configuration variables from versions 2.1-2.2 to 2.3.
* Permissions for local moderator and global moderator instead of moderator.
+ Checkbox to select all users of permissions.
+ SMF compatibility: 2.0.7.

2.2     2013-12-20
------------------
! SMF 2.0.x: Functions of administration area must return settings variables for the Quick Search of the Administration Center.
+ SMF 2.0.x: The Quick Search of the Administration Center look for in settings variables of MOD.
+ Variable in content of the block to insert URL to forum folder.

2.1     2013-11-02
------------------
! There was a PHP error when the list of blocks was empty.
! Error in source code.
+ Upgrade code to the configuration variables from version 2.0.x to 2.1.
+ Field to indicate if a block is active.
+ Custom blocks above and below the forum header and above and below the forum footer.

2.0     2013-10-23
------------------
! SMF 2.0.x: Integration hooks functions parameters must be passed by reference.
! If user does not have permission to view any block of forum header (or footer), default forum header (or footer) must be displayed.
+ Upgrade code to the configuration variables from version 1.x to 2.0.
+ Variable in content of the block to insert web address of forum.
+ Variable in content of the block to insert url to the images folder in the users current theme.
+ Variable in content of the block to insert url to the images folder in the default theme.
* Permissions for user, moderator and administrator instead of user (not guest).
+ Parameter frame of block, where writing the block border characteristics.
+ SMF compatibility: 1.1.19, 2.0.5 and 2.0.6.

1.0     2013-05-06
------------------
@ This work is licensed under a Creative Commons Attribution 3.0 Unported License http://creativecommons.org/licenses/by/3.0/
+ Custom blocks instead of default header and footer of forum.
+ Administration panel.
+ SMF compatibility: 1.1 to 1.1.18.
+ SMF compatibility: 2.0 to 2.0.4.
+ Languages: english, english-utf8, spanish_es, spanish_es-utf8, spanish_latin, spanish_latin-utf8.





New version:
2.4     2015-05-15
------------------
+ Field in administration panel to edit the position of the block.
+ Languages: polish, polish-utf8, thanks to FishingManMatt.
+ SMF compatibility: 1.1.21 and 2.0.10.

Advertisement: