REGISTER or LOGIN to have the annoying ads removed.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Idea/Suggestion
#1
I was wondering if you can make a plugin or something where we can input codes and it would shoot us back a variable to replace it. Like if I put PHP code in it and save it and make like a variable/shortcut so it would only be like {$menu} rather than putting the extended code in the header template. I want to make it a little bit cleaner this way. And if I can, can you please tell me how?

See I want this code to be put in my headers template so it would be on every page but if I just add the code there it would come up an error on my forums.
Code:
<?xml version="1.0" encoding="utf-8"?>
<!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" xml:lang="en-us">
<head>
    <link rel="stylesheet" type="text/css" href="css/main.css" />
    <link rel="stylesheet" type="text/css" href="css/jGlideMenu.css" />
    <!-- Current Release of jQuery - at time of build -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <!-- Remove the following line to disabled dragging-dropping / Also Edit CSS to Remove cursor:move from .jGM_header -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/jQuery.jGlideMenu.067.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            // Initialize Menu
            $('#jGlide_001').jGlideMenu({
                tileSource    : '.jGlide_001_tiles' ,
                demoMode    : true
            }).show();

            // Connect "Toggle" Link    
            $('#switch').click(function(){$(this).jGlideMenuToggle();});
        });
    </script>
</head>
<body>
<p><a href="index.html" title="Back to Overview">&laquo;&nbsp;Back to Project Overview</a></p>
<a href="#" id="switch">Toggle Menu Visibility</a>

<!-- Menu Holder -->
<div class="jGM_box" id="jGlide_001">

        This is Example One

        <!-- Tiles for Menu -->
        <ul id="tile_001" class="jGlide_001_tiles" title="Tile One" alt="Description for tile number one">
            <li rel="tile_002">Link One</li>
            <li rel="tile_003">Link Two</li>
            <li rel="tile_004">Link Three</li>
            <li><a href="http://www.google.com">Link to Google 1</a></li>
            <li><a href="http://www.google.com">Link to Google 2</a></li>
            <li><a href="http://www.google.com">Link to Google 3</a></li>
            <li><a href="http://www.google.com">Link to Google 4</a></li>
            <li><a href="http://www.google.com">Link to Google 5</a></li>
            <li><a href="http://www.google.com">Link to Google 6</a></li>
            <li><a href="http://www.google.com">Link to Google 7</a></li>
            <li><a href="http://www.google.com">Link to Google 8</a></li>
        </ul>
        <ul id="tile_002" class="jGlide_001_tiles" title="Tile Two" alt="Another Tile in This Example">
            <li rel="tile_005">Click Here</li>
            <li><a href="http://www.google.com">Link to Google</a></li>
        </ul>
        <ul id="tile_003" class="jGlide_001_tiles" title="Tile Three" alt="Third Tile is loaded up">
            <li><a href="http://www.google.com">Link to Google</a></li>
        </ul>
        <ul id="tile_004" class="jGlide_001_tiles" title="Search Engines" alt="Find your favorite search engine">
                        <li><a href="http://www.google.com">Link to Google</a></li>
            <li><a href="http://www.yahoo.com">Link to Yahoo!</a></li>
            <li><a href="http://www.ask.com">Link to Ask.com</a></li>
                </ul>
        <ul id="tile_005" class="jGlide_001_tiles" title="Tile Five" alt="Active Spot Light Link">
                        <li><a href="http://www.active8media.com">Link to ASL</a></li>
                </ul>
        <!-- Tiles for Menu -->
</div>
<!-- Menu Holder -->
</body>
<script type="text/javascript" src="/resources/js/plugins/google/analytics/gatag.js"></script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7365212-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</html>

Please feel free to contact me if you have an idea/suggestion Big Grin
AIM: ATLSYST3M4T1C
MSN: [email protected]
Reply
#2
This is the purpose of the plugin system itself.

As for adding that code above...you're just doing it wrong.

Some of that has to be inside header and some inside headerinclude

You also have to leave certain elements in headerinclude for mybb to work correctly.
Reply
#3
In the headerinclude I put this part of the code

Code:
<link rel="stylesheet" type="text/css" href="css/main.css" />
    <link rel="stylesheet" type="text/css" href="css/jGlideMenu.css" />
    <!-- Current Release of jQuery - at time of build -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <!-- Remove the following line to disabled dragging-dropping / Also Edit CSS to Remove cursor:move from .jGM_header -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/jQuery.jGlideMenu.067.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            // Initialize Menu
            $('#jGlide_001').jGlideMenu({
                tileSource    : '.jGlide_001_tiles' ,
                demoMode    : true
            }).show();

            // Connect "Toggle" Link    
            $('#switch').click(function(){$(this).jGlideMenuToggle();});
        });
    </script>

And I added this part of the code in the header
Code:
<script type="text/javascript" src="/resources/js/plugins/google/analytics/gatag.js"></script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7365212-1");
pageTracker._trackPageview();
} catch(err) {}</script>

But I get an error in my global.php file
Reply
#4
What's the error?
Reply
#5
This

Quote:Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in /home/***/public_html/***/forums/global.php(435) : eval()'d code on line 44

I'm guessing it's the two css files that came with this (main.css and jGlideMenu.css) so here's the code within them

main.css
Code:
#launch
                { font-family: tahoma,sans-serif; }
                a#launch
                { text-decoration: none; color: #535353; }
                a#launch:HOVER
                { text-decoration: underline; color: #f90; }
        .ifM_header
        { cursor: Move; }
        #overview a { color: darkgreen; text-decoration: none; }
        #overview a:HOVER { color: #f90; }
        #jGlide_001 { top: 100px; left: 10px; display: none; /* Hide Menu Until Ready(Optional) */ }

jGlideMenu.css
Code:
.jGM_box
                { position: absolute; top: 100px; left: 100px; width: 227px; height: 317px; background: #fff; margin: 0; padding: 0;
                        border: 1px solid #ccc; overflow: hidden; }
                .jGM_header
                { position: absolute; top: 0; left: 0; height: 18px; width: 227px; background: #d1d1d1; color: #fff;
                  text-align: right; vertical-align: middle; line-height: 18px; cursor: move; }
                .jGM_header a
                { margin-right: 12px; text-decoration: none; color: #fff; cursor: pointer; }
                .jGM_header a:HOVER
                { color: #333; }
                .jGM_wrapper
                { position: absolute; top: 19px; left: 0; width: 2270px; height: 288px; margin: 0; padding: 0; border: 0; } /* overflow: hidden; */
                .jGM_tile
                { position: absolute; top: 0; left: 7px; width: 213px; height: auto; overflow: hidden; margin: 0; padding: 0; border: 0; display: block; }
                .jGM_cats
                { width: 100%; height: 64px; overflow: hidden; vertical-align: middle; text-align: left; }
                .jGM_cats h1
                { font-family: Bookman Old Style,Verdana,Arial,serif; font-size: 1.8em; margin: 0; padding: 2px 0; line-height: 1.8em; color: #414141; font-weight: normal; }
                .jGM_cats p
                { font-family: verdana,tahoma,arial,sans-serif; font-size: 1em; margin: 0; padding: 0; line-height: 1.2em; color: #858585; font-weight: normal; }
                .jGM_pager
                { height: 18px; width: 213px; line-height: 18px; margin: 0; border: 0; padding: 0; background: #f6f6f6;
                        color: #fff; text-align: center; vertical-align: middle; }
                .jGM_pager a
                { text-decoration: none; color: #fff; font-weight: bold; text-decoration: none; color: #fff; display: block; }
                .jGM_pager a:HOVER
                { background: #d1d1d1; }
                .jGM_pager img
                { border: 0; margin: 6px 0; }
                .jGM_content
                { width: 213px; height: 150px; margin: 1px 0; padding: 0; border: 0; overflow: hidden; }
                .jGM_content a
                { text-decoration: none; color: #333; height: 18px; width: 100%; display: block; line-height: 18px; padding: 0 0 0 10px; background-color: #e6e7e9; margin: 1px 0; }
                .jGM_content a:HOVER
                { color: #fff; background-color: #f60; }
        .jGM_more
        { background-image: url(../img/arrow.gif); background-repeat: no-repeat; background-position: 203px 50%; }
                .jGM_back
                { position: absolute; top: 255px; right: 0; height: 18px; width: 52px; background: #d1d1d1; color: #fff; line-height: 18px;
                        vertical-align: middle; text-align: center; margin: 10px 0 0 0; padding: 0; border: 0; z-index: 99; }
                .jGM_back a
                { height: 100%; width: 100%; text-decoration: none; color: #fff; display: block; }
                .jGM_back a
                { color: #fff; background: #d1d1d1; }
                .jGM_back a:HOVER
                { color: #fff; background: #f60; }
                .jGM_reset
                { position: absolute; top: 255px; right: 62px; height: 18px; width: 52px; background: #d1d1d1; color: #fff; line-height: 18px;
                        vertical-align: middle; text-align: center; margin: 10px 0 0 0; padding: 0; border: 0; z-index: 99; }
                .jGM_reset a
                { height: 100%; width: 100%; text-decoration: none; color: #fff; display: block; }
                .jGM_reset a
                { color: #fff; background: #d1d1d1; }
                .jGM_reset a:HOVER
                { color: #fff; background: #f60; }

sorry if the coding looks weird; i just copied and pasted from notepad
Reply
#6
unexpected '('

Try editing this line:

#jGlide_001 { top: 100px; left: 10px; display: none; /* Hide Menu Until Ready(Optional) */ }

To be this:

#jGlide_001 { top: 100px; left: 10px; display: none; /* Hide Menu Until Ready */ }
Reply
#7
still get the same error except it's on line 43
Reply
#8
Any suggestions?
Reply
#9
I recieved no errors from the CSS or the template codes you provided.

That's leaves the javascripts.
Reply
#10
labrocca may i pm you all the files it comes with and you try it out?
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Wink Suggestion TheSpeedyFeed 1 2,238 Nov 17, 2013, 01:49 PM
Last Post: BlueShiftXD
  Prune Members 2.0 - Little Suggestion Dpower20 6 3,169 Feb 03, 2012, 01:59 AM
Last Post: skindu26
  Awesome plugin idea for Labrocca ToXiiC 1 1,092 Jan 21, 2012, 08:11 PM
Last Post: AceInfinity
  Monthly Stats Suggestion manchester10 3 1,955 Nov 07, 2011, 08:12 PM
Last Post: Oliver Evans
  CometJack's suggestion list! CometJack 7 3,974 Jul 23, 2010, 09:49 PM
Last Post: WhiteEagle

Forum Jump:


Users browsing this thread: 1 Guest(s)