Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #21  
Old 12-15-2014, 04:07 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,954
Kyttias is on a distinguished road
Default

Exactly. You'll need to find a solution that works in all browsers. Try making a css/html design of what you want yourself. The one I made worked in my browser, but I wasn't able to test it. If you need help transferring over your changes to the file we're editing (if you totally redo the divs and such) I'll be more than happy to help get the final file organized.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #22  
Old 12-15-2014, 04:20 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,954
Kyttias is on a distinguished road
Default

In the last jsbin I linked, I included your entire theme. If you remove your stylesheet (this one in particular - templates/blueqilin/media/style-blue.css ) the problem is fixed. Obviously you can't just remove your entire stylesheet, but for some reason, the problem is definitely in there. At least, that was what my gf was able to figure out so far on her computer. ><; So now it comes down to be a problem only in Firefox, specifically only with this theme.

In the meanwhile, I'll try to make sure item descriptions that contain apostrophes won't bug anything out. ^^;
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 12-15-2014 at 04:23 PM.
Reply With Quote
  #23  
Old 12-15-2014, 04:31 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,087
parayna is on a distinguished road
Default

I did it! I changed the 'display: inline-block;' to 'display: inline-table;' And I put it in my CSS file so I can later change the colours for my themes :P Thanks for the offer to help, but I decided I needed to try and do something for myself so I googled different CSS display commands and found one that worked :P

Now to check if it works in Chrome (works in Firefox at the moment)

EDIT: Yup! Works! ^_^ Happy now XD I can finally go to bed >.<

Thanks!

And OK, thank you ^_^
Reply With Quote
  #24  
Old 12-15-2014, 04:45 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,954
Kyttias is on a distinguished road
Default

Mm, that definitely works because your theme uses a table. If you ever switch to one that does not, things may break again, but I dunno. In your css (the one I mentioned) very early on there's an area where it defines br? Everything would also be fixed if you removed display: block; from that. At least, that's what my gf found, ahaha. ^^;
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #25  
Old 12-15-2014, 05:15 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,087
parayna is on a distinguished road
Default

Oh, alright! That might be a tiny bit easier actually... as then it would hopefully not break if I ever get brave and try and create a theme completely from scratch :P Thank them for me ^_^ And also thank you :P
Reply With Quote
  #26  
Old 12-15-2014, 05:53 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,087
parayna is on a distinguished road
Default

I have another question >.< Sorry, I am curious D: Would it be possible to make the inventory look like the shop? So it would not have the NPC or text just the item boxes and the item names and how much quantity you have at the moment? (With the tooltips eventually) And with a button to use the item? (And maybe the button leads to the page where you select the pet you wish to use it on)
Reply With Quote
  #27  
Old 12-15-2014, 06:39 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,954
Kyttias is on a distinguished road
Default

It's entirely possible! *chuckle* Look, if you can create a fake screenshot of what you want, and even better, make it with html/css in a jsbin and link it to me, then I can try to make it for you.

Keep in mind that not all items are useable, or at least not useable on pets. You may not have plans for any items like this right now, but you may in the future. (Say you need to own 'Shiny Key' to access to a certain page. It has no use, you just have to own it, so there would be no need for there to be a use button. You'll need to show me how you want items that don't need a use button to look, too.) For items with a use button, it does indeed already take users to another page to select a pet.

Items can also be sold. You also get to choose a quantity to sell. (I personally recommend getting rid of the 'toss' button, at that point, if that's alright? Less clutter for something you can essentially already do by selling the item.)
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #28  
Old 12-15-2014, 11:33 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,954
Kyttias is on a distinguished road
Default

Tooltip time!

In your directory where Mysidia is installed there is a css folder (not talking about anything theme-related in the template folder, this css folder is the one at the root). We're going to add this as tooltip.css -

  Spoiler: tooltip.css 
HTML Code:
#tooltip
{
    text-align: center;
    color: #fff;
    background: #111;
    position: absolute;
    z-index: 100;
    padding: 15px;
}
 
    #tooltip:after /* triangle decoration */
    {
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid #111;
        content: '';
        position: absolute;
        left: 50%;
        bottom: -10px;
        margin-left: -10px;
    }
 
        #tooltip.top:after
        {
            border-top-color: transparent;
            border-bottom: 10px solid #111;
            top: -20px;
            bottom: auto;
        }
 
        #tooltip.left:after
        {
            left: 10px;
            margin: 0;
        }
 
        #tooltip.right:after
        {
            right: 10px;
            left: auto;
            margin: 0;
        }


A nearby folder, also in the heart of things, is called js. Open up this folder and add this as tooltip.js:
  Spoiler: tooltip.js 
HTML Code:
/*
        TOOLTIP
    */

    $( function()
    {
        var targets = $( '[rel~=tooltip]' ),
            target  = false,
            tooltip = false,
            title   = false;

        targets.bind( 'mouseenter', function()
        {
            target  = $( this );
            tip     = target.attr( 'title' );
            tooltip = $( '<div id="tooltip"></div>' );

            if( !tip || tip == '' )
                return false;

            target.removeAttr( 'title' );
            tooltip.css( 'opacity', 0 )
                   .html( tip )
                   .appendTo( 'body' );

            var init_tooltip = function()
            {
                if( $( window ).width() < tooltip.outerWidth() * 1.5 )
                    tooltip.css( 'max-width', $( window ).width() / 2 );
                else
                    tooltip.css( 'max-width', 340 );

                var pos_left = target.offset().left + ( target.outerWidth() / 2 ) - ( tooltip.outerWidth() / 2 ),
                    pos_top  = target.offset().top - tooltip.outerHeight() - 20;

                if( pos_left < 0 )
                {
                    pos_left = target.offset().left + target.outerWidth() / 2 - 20;
                    tooltip.addClass( 'left' );
                }
                else
                    tooltip.removeClass( 'left' );

                if( pos_left + tooltip.outerWidth() > $( window ).width() )
                {
                    pos_left = target.offset().left - tooltip.outerWidth() + target.outerWidth() / 2 + 20;
                    tooltip.addClass( 'right' );
                }
                else
                    tooltip.removeClass( 'right' );

                if( pos_top < 0 )
                {
                    var pos_top  = target.offset().top + target.outerHeight();
                    tooltip.addClass( 'top' );
                }
                else
                    tooltip.removeClass( 'top' );

                tooltip.css( { left: pos_left, top: pos_top } )
                       .animate( { top: '+=10', opacity: 1 }, 50 );
            };

            init_tooltip();
            $( window ).resize( init_tooltip );

            var remove_tooltip = function()
            {
                tooltip.animate( { top: '-=10', opacity: 0 }, 50, function()
                {
                    $( this ).remove();
                });

                target.attr( 'title', tip );
            };

            target.bind( 'mouseleave', remove_tooltip );
            tooltip.bind( 'click', remove_tooltip );
        });
    });


Now, in your theme's header.tpl, add in these lines (before the end of the </head>, of course):
  Spoiler: Inside header.tpl: 
HTML Code:
{$header->loadStyle("{$home}{$css}/tooltip.css")}
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
	<script src="{$home}{$js}/tooltip.js"></script>


You now have all the necessary components for tooltips.

To make tooltips elsewhere on your site, from now on, all you need to do is add title="Contents of the tooltip here!" rel="tooltip" to any element you want to have a tooltip. Could be links, divs, spans, images, etc. You can also use some basic html inside them, such as italicies, bold, and linebreaks.

For more reference on the tooltip system I just had you install, visit this link.

-

Moving along, here is the final version of classes/class_itemshop.php:

  Spoiler: classes/class_itemshop.php 
PHP Code:
<?php

use Resource\Collection\LinkedList;

class 
Itemshop extends Model{

    public 
$sid;
    public 
$category;
    public 
$shopname;
    public 
$shoptype;
    public 
$description;
    public 
$imageurl;
    public 
$status;
    public 
$restriction;
    public 
$salestax;
    public 
$items;
    protected 
$total 0;
  
    public function 
__construct($shopname){
        
// Fetch the database info into object property      
        
$mysidia Registry::get("mysidia");
        
$row $mysidia->db->select("shops", array(), "shopname ='{$shopname}'")->fetchObject();
        if(!
is_object($row)) throw new Exception("Invalid Shopname specified");
      
        
// loop through the anonymous object created to assign properties
        
foreach($row as $key => $val){
            
$this->$key $val;         
        }
        
$this->items $this->getitemnames();
        
$this->total = (is_array($this->items))?count($this->items):0;
    }

    public function 
getcategory(){
        
$mysidia Registry::get("mysidia");
        
$stmt $mysidia->db->select("shops", array(), "category ='{$this->category}'");
        
$cate_exist = ($row $stmt->fetchObject())?TRUE:FALSE;     
        return 
$cate_exist;
    }
  
    public function 
getshop(){  
        
$mysidia Registry::get("mysidia");
        if(empty(
$this->shopname)) $shop_exist FALSE;
        else{
            
$stmt $mysidia->db->select("shops", array(), "shopname ='{$this->shopname}'");
            
$shop_exist = ($row $stmt->fetchObject())?TRUE:FALSE;    
        }
        return 
$shop_exist;
    }
  
    public function 
getitemnames(){
          if(!
$this->items){
            
$mysidia Registry::get("mysidia");        
            
$stmt $mysidia->db->select("items", array("itemname"), "shop ='{$this->shopname}'");
            
$items = array();
        
            while(
$item $stmt->fetchColumn()){
                
$items[] = $item;
            }
            return 
$items;
        }
        else return 
$this->items;
    }
  
    public function 
gettotal(){  
        return 
$this->total;
    }
  
    public function 
display(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();              
        
$document->addLangvar($mysidia->lang->select_item);
      
        if(
$this->gettotal() == 0){
            
$document->addLangvar($mysidia->lang->empty);
            return 
FALSE;
        }

        
# Choose the NPC image based on the name of the shop
        
switch ($this->shopname) {
            case 
"Crossed Roads":                     
                
$npc_img "http://fc00.deviantart.net/fs71/f/2014/262/a/2/base_npc_60_by_kyttias-d7zqrnf.png";
                
#Based on the random number, sets a quote for $npc_text
                
$num Rand (1,6);   
                switch (
$num) { 
                        case 
1$npc_text "Time is money."; break; 
                        case 
2$npc_text "Isn't icecream super?"; break; 
                        case 
3$npc_text "Welcome to {$this->shopname}!"; break; 
                        case 
4$npc_text "Off to see the wizard?"; break; 
                        case 
5$npc_text "Tomorrow is another day..."; break; 
                        case 
6$npc_text "PHP is cool!"; }                            
                break;
            case 
"Spectrum"
                
$npc_img "http://fc00.deviantart.net/fs70/f/2014/313/a/c/base_npc_2_60_by_kyttias-d85ww5k.png";
                
#Based on the random number, sets a quote for $npc_text
                
$num Rand (1,6);   
                switch (
$num) { 
                        case 
1$npc_text "Time is money."; break; 
                        case 
2$npc_text "Isn't icecream super?"; break; 
                        case 
3$npc_text "Welcome to {$this->shopname}!"; break; 
                        case 
4$npc_text "Off to see the wizard?"; break; 
                        case 
5$npc_text "Tomorrow is another day..."; break; 
                        case 
6$npc_text "PHP is cool!"; }                   
                break;
            default; 
                
$npc_img "http://placekitten.com/g/200/500";
                
$npc_text "Welcome to {$this->shopname}!";
                break;
        }
        
        
# let's begin rendering the page
        
$document->add(new Comment("
            <style>
                .s_top {
                  overflow:hidden;
                  display: block;
                  margin-bottom: 10px;
                }
                .sc_npc_text{  
                  width: 300px;
                  float: left;
                  position: relative;
                  height: 100px;
                  padding: 15px;
                  margin: 10px;
                  margin-top: 200px;
                  font-family: 'Trebuchet MS', Helvetica, sans-serif;
                  overflow: auto;
                }
                .sc_npc_img{  
                  width: 40%;
                  float: left;
                }

                .sc_item {
                  display: inline-block;
                  padding: 5px;
                  text-align: center;
                  font-family: 'Trebuchet MS', Helvetica, sans-serif;
                  font-size: 14px;
                  margin-bottom: 3px;
                }
                .s_panel {
                  border-radius: 4px;
                  border: 1px solid #466ec3;
                  background-color: #ccf3f6;  
                }
            </style>
            <!-- START Container for Text and NPC -->
                <div class='s_top s_container'>
                    <div class='s_panel sc_npc_text'>
{$npc_text}</div>
                    <div class='sc_npc_img'><img  src='
{$npc_img}' border='5' height='450'></div>    
                </div>
            <!-- END Container for Text and NPC -->
            <!-- START Container for Items -->
                  <div class='s_container'>    
        "
FALSE));    
            
        
# Now render each item the store has
        
foreach($this->items as $stockitem){
              
$item $this->getitem($stockitem);
            
              
#descriptions of the item functions
            
switch ($item->function) {
                case 
"Click1"$usage "<br/><b>use:</b> Feed a pet to give them {$item->value} EXP.";
                    break;
                  case 
"Click2"$usage "<br/><b>use:</b> Feed a pet to set their EXP to {$item->value}.";
                    break;
                  case 
"Click3"$usage "<br/><b>use:</b> Resets EXP earned today to 0.";
                    break;
                  case 
"Level1"$usage "<br/><b>use:</b> Raises the Level of your pet by {$item->value}.";
                    break;
                  case 
"Level2"$usage "<br/><b>use:</b> Sets the Level of your pet to {$item->value}.";
                    break;
                case 
"Level3"$usage "<br/><b>use:</b> Makes your pet Level 0 again!";
                    break;
                case 
"Gender"$usage "<br/><b>use:</b> Swaps the gender of your pet to its opposite!";
                    break;            
                default;
                    
$usage "";
                    break;
            }                        

            
# Now let's render each item icon, name, price and tooltip
            
$document->add(new Comment("
                <div class=\"s_panel sc_item\">
                <img rel=\"tooltip\" title=\"
{$item->description} <em>{$usage}</em>\" src=\"{$item->imageurl}\"/><br/>
                  <b>
{$item->itemname}</b>
                  <br/>
                  
{$item->price} Credits<br/>
                "
FALSE));


            
# Building the Buy form
            
$buyForm = new FormBuilder("buyform""../purchase/{$mysidia->input->get("shop")}""post");
            
$buyForm->setLineBreak(FALSE);
            
$buyForm->buildPasswordField("hidden""action""purchase")
                    ->
buildPasswordField("hidden""itemname"$item->itemname)
                    ->
buildPasswordField("hidden""shopname"$shop->shopname)
                    ->
buildPasswordField("hidden""shoptype""itemshop")
                    ->
buildPasswordField("hidden""salestax"$shop->salestax);
            
$quantity = new TextField("quantity");
            
$quantity->setSize(3);
            
$quantity->setMaxLength(3);
            
$quantity->setLineBreak(FALSE);        
            
$buy = new Button("Buy""buy""buy");
            
$buy->setLineBreak(FALSE);
            
$buyForm->add($quantity);
            
$buyForm->add($buy);

            
# Actually adding in the Quantity field Buy button now
             
$document->add($buyForm);

            
# Now we finish off the item by closing its div
            
$document->add(new Comment("</div>"FALSE)); 
        }  

        
# And that's a wrap
        
$document->add(new Comment("</div><!-- END Container for Items -->"FALSE));

    } 
  
    public function 
getitem($itemname){
      return new 
StockItem($itemname);
    }
  
    public function 
purchase(Item $item){
        
$mysidia Registry::get("mysidia");
        if(
$item->owner != $mysidia->user->username) Throw new NoPermissionException('Something is very very wrong, please contact an admin asap.');
        else{
            
$item->quantity $mysidia->input->post("quantity");
            
$cost $item->getcost($this->salestax$item->quantity);
            
$moneyleft $mysidia->user->money $cost;
            if(
$moneyleft >= and $item->quantity 0){    
                
$purchase $item->append($item->quantity$item->owner);
                
$mysidia->db->update("users", array("money" => $moneyleft), "username = '{$item->owner}'");            
                
$status TRUE;
            }            
            else throw new 
InvalidActionException($mysidia->lang->money);
        }
        return 
$status;
    }
  
    public function 
rent($item$period){

    }
  
    public function 
execute($action){
    
    }
  
      protected function 
save($field$value){
        
$mysidia Registry::get("mysidia");
        
$mysidia->db->update("shops", array($field => $value), "sid='{$this->sid}' and shoptype = 'adoptshop'");
    }  
}
?>


Finally, I'm happy to inform you that is absolutely safe to use apostrophes inside of item names, item descriptions, shop names, and the NPC text. However, please refrain from using quotation marks in any of these areas.

So, to clarify, DO NOT:
"Sour" Candy
This is an "official" fanclub hair pin.
The "Best" Shop
"Welcome", says the shopkeeper.

It would, however, okay, to use single quotes instead, as these are just apostrophes and apostrophes are okay!
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 12-15-2014 at 11:46 PM.
Reply With Quote
  #29  
Old 12-16-2014, 01:43 AM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,087
parayna is on a distinguished road
Default

I have no time to make a screenshot now, school beckons, but I can when I come home. Thanks for the tooltips! They have slashes in though.. where there are apostrophes. Do we need to add in (stripslashes) codes? It also still happens in the Store name unless that is to do with the admin CP not liking shops with slashes in the name to be created.. (or apostrophes as it automatically adds them in). Do you know where I would put the stripslashes in? I have managed it with many things in the script before, just I can't find where to put it this time XD
Reply With Quote
  #30  
Old 12-16-2014, 02:44 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,954
Kyttias is on a distinguished road
Default

That's really odd. I tested with my items, and one of them has an apostrophe in it's description and showed no slash. =| Usually you have to manually put in slashes, not manually remove them. So maybe they were put in when the item was created. Check in the database table for me? I may have found a slash in mine and removed it directly in the database itself, I cant remember.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
visitors do not write messages in the shoutbox? kratosvr Questions and Supports 1 10-29-2011 07:45 PM
Not show shop adopts on adopt page SilverDragonTears Questions and Supports 0 08-16-2011 06:57 PM
Ad code "unable to write" LilPixie Questions and Supports 4 03-26-2009 01:07 PM
Re-Write suggestions rosepose Suggestions and Feature Requests 4 03-22-2009 07:13 PM
Suggestions For The Possible Re Write gjac1 Suggestions and Feature Requests 2 03-19-2009 05:15 AM


All times are GMT -5. The time now is 09:55 AM.

Currently Active Users: 153 (0 members and 153 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636