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
  #1  
Old 12-24-2013, 06:50 PM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 24,016
Infernette is on a distinguished road
Default Help on how to make an element that pops up when something in the Db changes?

Okay I want to make something that when something the the DB changes (ex. A value like 'tricks' changes by someone tricks that person) a little icon pops up on the current page when it occurs, without refreshing. I was wondering if anyone had any pointer on how to get something like that started.

I just need a few tips in the right direction, you don't need to write up a code. I was wondering if with the mysidia base this would be possible as well, or if the base is not made to handle something this. I was just thinking of making a little game on my site so if it isn't possible it doesn't matter.


Thank you for any and all help, and I hope you have a good holiday.

(I need to learn more stuff in coding ^^)
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #2  
Old 12-24-2013, 07:56 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,446
IntoRain is on a distinguished road
Default

I didn't quite get it, like changing a value and something in the page changing automatically without refreshing? That I think only works with javascript I think, by calling update functions

What type of game is it? Thre might be some examples online in javascript for simple games
__________________


asp.net stole my soul.
Reply With Quote
  #3  
Old 12-24-2013, 08:02 PM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 24,016
Infernette is on a distinguished road
Default

It's more of someone can push a button on your profile and it causes a value to change in the db, which changes your end without you refeshing. I was hoping to use it for a battle-esq system(person clicks attack, updates your end and shows you lost hp). I know javascript would be useful for sure, not so sure if it'll work with the mysidia page setup.
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #4  
Old 12-24-2013, 08:17 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,446
IntoRain is on a distinguished road
Default

I see, I think that really requires javascript and maybe ajax, no idea how that can be easily achieved with just php in mysidia sorry x.x
__________________


asp.net stole my soul.
Reply With Quote
  #5  
Old 12-24-2013, 10:34 PM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 24,016
Infernette is on a distinguished road
Default

Well I'm open to other languages, it's just I don't know if mysidia is XD
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #6  
Old 01-15-2014, 09:11 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,446
IntoRain is on a distinguished road
Default

jQuery and javascript seem to be working well with mysidia's script. Sorry to bump, just wanted to tell you! Didn't try ajax yet, which you would need to be able to communicate with the php which communicates with the database

If you put the script tags (includes or the functions themselves) in the header.tpl of the theme you are using they work properly ^^

try it:

in header.tpl (remove comments):

Code:
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> /* include jquery without downloading it */

<script>
function alertme(){ /*simple JS function that makes a popup */
	alert('omg');
}

$(document).ready(function(){ /* simple jQuery function that makes a popup when you click the menu (anywhere in the menu) */
       $('div #menu').click(function(){
                   alert('OMGGG');
        });
});
</script>

/////////REST OF CODE HERE////////////
</head>
template.tpl (to test first javascript alert):
Code:
///CODE BEFORE HERE///
<body onload="alertme()">
///REST OF CODE HERE///


And this makes it work in php pages (so the different elements/tags will work differently depending on the page)
inside the index() function
Code:
	    echo '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>';
	    echo "<script>	
	    	$(document).ready(function(){
		$('h1').click(function(){ /*send an alert when the title is clicked */
			alert('OMG2');
			});
	});</script>";
JS and jQuery work on the HTML basically, makes it hard to use it on mysidia's pages (at least I haven't found a new way to create new ids and classes? I still don't quite get how it works)
__________________


asp.net stole my soul.

Last edited by IntoRain; 01-15-2014 at 02:04 PM.
Reply With Quote
  #7  
Old 01-16-2014, 08:09 PM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 24,016
Infernette is on a distinguished road
Default

Question, what exactly does that example you posted do XD

Whatever it does, it definitely seems to be what I'm looking for- and I'm quite glad that it can be incorported with the site!
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #8  
Old 01-16-2014, 08:37 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,446
IntoRain is on a distinguished road
Default

They all create popups depending on the situation xD JS and jQuery work with HTML. For example jQuery can be used to interact with HTML's tags. In the php example, if you use it say in the my adopts php page, it will activate an popup with the message "OMG2" as soon as you click on the page's title ( $('h1').click(function(){***code***}) <- when a h1 HTML element is clicked it creates a new function and does whatever the function should do).
There are many other functions besides click (when mouse hovers, when form's input field is selected, when submit button is clicked, etc).
The other JS function works whenever it is called. It can be called normally or on certain events (<body onload="alertme()"> when the body loads, calls the function).

That way you can check when someone clicks a button and it will change something in the page automatically. You can add HTML elements and change them (even their CSS!). For example with this $('div').append('<div>NEW DIV</div>') it will add a new div to the page without refreshing after div (like so http://api.jquery.com/append ).

However, to check the DB you will need ajax as well x.x but you most likely can use it, since jQuery works
__________________


asp.net stole my soul.
Reply With Quote
Reply


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
Disable Inspect Element SilverDragonTears Questions and Supports 2 10-28-2011 10:10 AM
Make users make their own website on your site ... kitty08 Mys v1.2.x Mods 0 10-27-2011 03:49 PM
Just to make sure... ipengu Questions and Supports 4 08-20-2011 05:00 PM
Where do i go to make one? Amber Questions and Supports 3 12-07-2009 03:05 PM
How do you make... Blue Icebox Questions and Supports 2 02-20-2009 12:49 AM


All times are GMT -5. The time now is 03:55 PM.

Currently Active Users: 10649 (0 members and 10649 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