Tip button in template

Discussion in 'Customizations' started by zooi, Dec 5, 2010.

  1. zooi Customer

    Hello,

    I use C68 v4.2.1 Developer with the Sigma Ocean template.

    I'm busy for days now to add a TIP button to the template in layout.tpl

    Unfortunately I can't get it done.... but if I put the code in a seperate page it works mighty fine, see Click here to see example

    Here is the code: (of course I have included the php code with {php} code {/php}


    Code:
    <?php
    include 'include/SmarTip.php';
    $SmarTip = new SmarTip('normalTip');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
        <head>
            <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript" ></script>
            <script src="js/smarTip.js" type="text/javascript" ></script>
            <?php
                echo $SmarTip->getDecorators();
            ?>
            <title>Your Web Title</title>
        </head>
        <body>
        <?php
            echo $SmarTip->runSmarTip();
        ?>
        <!-- Your site here -->
        </body>
    </html>
    I have also tried to rewrite it to smarty template - but I have to practice some more

    Who can give me a hint to get this to work?

    Thank you for help
  2. Lhotch curmudgeon

    Its likely a path issue. Your trying to call $SmarTip in a template but where is the underlying php file?
  3. Blair Administrator

    I agree with Larry.
    It's likely a path issue.
  4. zooi Customer

    Larry, Blair,

    Thank you for your help. I try to solve the path issue, but I'm not sure if that is the problem (maybe I oversee something)

    This is how it is in the layout.tpl



    Code:
    {php}
    include 'modules/Smartip/include/SmarTip.php';
    $SmarTip = new SmarTip('normalTip');
    {/php}
    <!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" lang="en">
    <head>
    	<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    	<meta name="author" content="TemplateCodes.com, modified by KeesB" />
    	<title>{$sitetitle}</title>
    	<meta name="Keywords" content="{$sitekeywords}" />
    	<meta name="Description" content="{$sitedescription}" />
    	{if $smarty.server.SERVER_PORT == '443'}
    	<base href="{$smarty.const.URLS}/" />
    	{else}
    	<base href="{$smarty.const.URL}/" />
    	{/if}
        {php}echo $SmarTip->getDecorators();{/php}
    	<link rel="stylesheet" href="templates/{$smarty.const.MAIN_TEMPLATE}/css/style.css" type="text/css" />
        <link rel="stylesheet" type="text/css" media="screen" href="templates/{$smarty.const.MAIN_TEMPLATE}/css/superfish2.css" />
        <link rel="shortcut icon" href="favicon.ico">
    	<!--[if IE]>
    	<link rel="stylesheet" href="templates/{$smarty.const.MAIN_TEMPLATE}/css/ie.css" type="text/css" />
    	<![endif]-->
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript" ></script>
        <script type="text/javascript" src="modules/Smartip/js/smarTip.js"></script>
    	<script type="text/javascript" src="modules/templatecodes/scripts/jquery-1.3.2.min.js"></script>
    	<script type="text/javascript" src="javascript/main.js"></script>
    	<script type="text/javascript" src="modules/templatecodes/scripts/jcook.js"></script>
    	<script type="text/javascript" src="modules/templatecodes/scripts/layout.js"></script>
    	<script type="text/javascript" src="modules/templatecodes/scripts/superfish.js"></script>
    	{literal}
    		<script type="text/javascript">
    		<!--//
    		$(document).ready(function(){
    		$('.sf-menu').superfish();
    		});
    		//-->
    		</script>
    	{/literal}
    	{$header}
    	{modulehook function="tpl_layout_head" options=""}
    </head>
    <body>
    <!--
    This template was designed and sold by TemplateCodes.com (An Adept Marketing Business) © 2009 TemplateCodes.com All Rights Reserved.
    -->
    {php} echo $SmarTip->runSmarTip();{/php}
    <div id="wrapper">
    bla
    bla
    etc
    Enclosed the underlaying php file SmarTip.php

    All underlaying files are located in the folders: css, images, js, include under

    /httpdocs/modules/Smartip/

    Attached Files:

  5. Lhotch curmudgeon

    You have

    include 'include/SmarTip.php';

    in your template which means that since its being called from a template its going to look for the smartip.php file in your template folder, is that where you have the files?
  6. zooi Customer

    Ok checked once more and Yes..in /httpdocs/modules/Smartip/include/SmarTip.php

    but still don't work
  7. Lhotch curmudgeon

    No, thats not what I asked, I asked if it was in your TEMPLATE folder because thats where your telling it to look.

    Assuming 68C is installed in the root of your site and your using the default template, your templates are in

    /httpdocs/templates/default

    so when a template file loads thats where its going to start looking but your telling it smartip is in /includes so its actually going to be looking in

    /httpdocs/templates/default/includes
  8. zooi Customer

    Hello Larry,

    Yes C68 is in the root and in C68 there is a folder modules and in the folder modules there is a folder Smartip and in the folder Smartip there is a folder include and in this folder there is SmarTip.php

    I try to understand but somewhere I don't understand your question or I miss interpret it...

    I include the SmarTip.php include 'modules/Smartip/include/SmarTip.php'; from my point of view it is going to search in the right place.

    My templates are in /httpdocs/templates/Sigma-Ocean/

    I think what I have done is correct........but ok I'm not sure any more

    If I look to the source of my page then {php} echo $SmarTip->runSmarTip();{/php}
    give as output
    HTML:
    <div id="smarTip"><div class="bulb imagen" id="bulb"></div></div><div id="wrapper">
    but {php}echo $SmarTip->getDecorators();{/php} should give a style sheet as out put but it don't show up
  9. Blair Administrator

    Zooi-

    You're layout.tpl file is in the templates/default/ folder. You're trying to include the modules/Smartip/include/SmarTip.php file.
    So, if you say
    Code:
    include 'modules/Smartip/include/SmarTip.php'; 
    The code is looking for the modules/ folder inside the templates/default/ folder

    Try this:
    Code:
    {php}
    include '../../modules/Smartip/include/SmarTip.php';
    $SmarTip = new SmarTip('normalTip');
    {/php}
    
  10. zooi Customer

    Hello Blair,

    I tried your suggestion, but the result is

    HTTP-fout 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
  11. Mike-N-Tosh Developer & Moderator

    I don't know for sure if this is causing any issues or not, but generally speaking I wouldn't include this code above the doctype declaration of the page. Since you are using the smarty php identifier, why don't you put it either in the <head> section or in the actual <body>.

    As you already stated that this php file is calling a stylesheet (and we don't know what else), calling a stylesheet before you even declare a doctype, in my opinion, is not going to work, as stylesheets are called and loaded in the <head> section of an XHTML document. How would the browser rendering engine even know what to do with a stylesheet if it doesn't even know what kind of a document it is???

    In addition, you are using relative addressing when you haven't even established a base href (the base href is in the head section), so how would it know where to go? In relation to what??? If you put a link in the head section above the base href declaration using relative addressing, it will not load.

    I believe this will work using the relative address that Blair provided, as long as you put your code anywhere after both the doctype declaration and the base href declaration.
  12. Blair Administrator

    Sorry it doesn't work. Instead of using my former post as a literal solution, use it as an example of different paths to try.

    Mike's gotta good point as well.

    Something else - if it's just styles that you're trying to include, you could copy and paste the style definitions to the stylesheet of the template you're using now.
  13. zooi Customer

    Dear Mike,

    I had just followed the instructions in the user guide of this SmarTip, see enclosed zip file

    However I followed your instructions but unfortunately a blank page appeared.

    Attached Files:

  14. Lhotch curmudgeon

    I wouldnt put anything in the .modules folder but a module designed to be installed via the 68C module system.

    I would put the smartip folder inside your template folder.
  15. Mike-N-Tosh Developer & Moderator

    I agree with Larry and was also going to suggest that as well in my last post.

    Although you are following the instructions provided by the developers of your script that you are using, obviously that isn't going to work that way with the 68C script. As with many technological things, there are several factors. I'm sure that the developers of the smart tip script aren't aware of how the 68C script works, or with the use of smarty and the configuration of smarty to boot.

    There are several things that could be going on including the fact that we don't know what the php script is trying to echo out, or what else it may be calling. If it's echoing out javascript, then the javascript in a smarty template has to have a {literal} {/literal} around the code. There could be conflicting variable names in the php and/or in the CSS elements as well.

    Unfortunately, you're going to need to go through their code to see what it's doing and probably make modifications. If you don't have the knowledge to that, then you might want to consider hiring someone who does. Classifiedmods.com
  16. zooi Customer

    Ok. I will go through the code and let you know if it works.

    Thanks for all the help so far.

Share This Page