|
||
|
|||||||
| Script Languages Perl/PHP/Python/Ruby so on and so forth. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
|
I'm new to PHP so bare with me
![]() Is there a particular order to creating a web page where you should define your variables, i know some languages get picky with case, does PHP do the same but in an order of whats where in the file ? Is it along the lines of the same thing like C# classes or something, like (example)... Code:
{
Variable def's here
{
Code
}
}
PHP Code:
Anyone ? |
|
|
|
|
|
#2 (permalink) |
|
Account Terminated
Join Date: Jun 2004
Location: Cincinnati, Ohio
Age: 20
Posts: 3,954
|
I'd say that your best place to find answers would be to look through the first few chapters of the PHP online manual. PHP: PHP Manual - Manual
Specifically, this is the chapter on variables. PHP: Variables - Manual You can place PHP code at any place of your file, as long as it is between a beginning '<?php' and an ending '?>'. This includes inside of HTML. Code:
<td> <?php Your code can go here! ?> </td> |
|
|
|
|
|
#3 (permalink) | |
|
Forum Novice
|
Quote:
Yeah, i have a few PHP manuals downloaded, hate reading those ![]() |
|
|
|
|
|
|
#5 (permalink) |
|
Forum Novice
|
* the lights are on and theres no one home *
Thanks, that clears up the messyness problems i was having ![]() So in some respects, you have to have the PHP you want to access in a 'class' something like when your make a c# object (private, public as a nasty example), the PHP is like considered private to the <php & ?> area. Np's i get the gist of it now. |
|
|
|
|
|
#6 (permalink) |
|
Account Terminated
Join Date: Jun 2004
Location: Cincinnati, Ohio
Age: 20
Posts: 3,954
|
It really depends on your coding style. You could simply have the entire file be inside the php definition area and produce the HTML using PHP. It doesn't really have anything to do with public or private, but for organization and aesthetics. It is also very difficult to compare C# to PHP because, unless you are specifically using PHP's object-oriented features, they are really not the same idea. One is procedural and one is object-oriented.
Last edited by WarAngel; 01-20-2007 at 02:57 PM. |
|
|
|
|
|
#7 (permalink) | |
|
Forum Novice
|
Quote:
Have a look... Shard Millionaires If you have myrunuo working, i've updates some old scripts i found for PHP relating to it, i'll attach them. This is the new table layout which will work with the MyRunUO part if you replace the script file... Code:
-- MySQL dump 9.10 -- -- Host: localhost Database: MyRunUO -- ------------------------------------------------------ -- Server version 4.0.20a-nt -- -- Table structure for table `myrunuo_characters` -- CREATE TABLE myrunuo_characters ( char_id int(12) unsigned default NULL, char_name varchar(150) default NULL, char_str int(3) unsigned default NULL, char_dex int(3) unsigned default NULL, char_int int(3) unsigned default NULL, char_female int(2) unsigned default NULL, char_counts int(3) unsigned default NULL, char_guild varchar(4) default NULL, char_guildtitle varchar(150) default NULL, char_nototitle varchar(150) default NULL, char_bodyhue int(3) unsigned default NULL, char_public int(1) unsigned default NULL, char_bankaccount int(12) unsigned default NULL, KEY char_id (char_id), KEY char_guild (char_guild) ) TYPE=MyISAM; -- -- Table structure for table `myrunuo_characters_layers` -- CREATE TABLE myrunuo_characters_layers ( char_id int(12) unsigned default NULL, layer_id int(3) unsigned default NULL, item_id int(12) unsigned default NULL, item_hue int(3) unsigned default NULL, KEY charid (char_id) ) TYPE=MyISAM; -- -- Table structure for table `myrunuo_characters_skills` -- CREATE TABLE myrunuo_characters_skills ( char_id int(12) unsigned default NULL, skill_id int(3) unsigned default NULL, skill_value int(3) unsigned default NULL, KEY charid (char_id), KEY skillid (skill_id) ) TYPE=MyISAM; -- -- Table structure for table `myrunuo_guilds` -- CREATE TABLE myrunuo_guilds ( guild_id varchar(4) default NULL, guild_name varchar(150) default NULL, guild_abbreviation varchar(4) default NULL, guild_website varchar(150) default NULL, guild_charter varchar(250) default NULL, guild_type varchar(8) default NULL, guild_wars int(3) unsigned default NULL, guild_members int(3) unsigned default NULL, guild_master int(12) unsigned default NULL, KEY guild_id (guild_id) ) TYPE=MyISAM; -- -- Table structure for table `myrunuo_guilds_wars` -- CREATE TABLE myrunuo_guilds_wars ( guild_1 varchar(4) default NULL, guild_2 varchar(4) default NULL, KEY guild1 (guild_1), KEY guild2 (guild_2) ) TYPE=MyISAM; -- -- Table structure for table `myrunuo_status` -- CREATE TABLE myrunuo_status ( char_id int(12) unsigned default NULL, char_location varchar(14) default NULL, char_map varchar(8) default NULL, char_karma int(6) default NULL, char_fame int(6) default NULL, KEY charid (char_id) ) TYPE=MyISAM; -- -- Table structure for table `myrunuo_timestamps` -- CREATE TABLE myrunuo_timestamps ( time_datetime varchar(22) default NULL, time_type varchar(6) default NULL ) TYPE=MyISAM; Code:
public void InsertMobile( Mobile mob )
{
string guildTitle = mob.GuildTitle;
if ( guildTitle == null || (guildTitle = guildTitle.Trim()).Length == 0 )
guildTitle = "NULL";
else
guildTitle = SafeString( guildTitle );
string notoTitle = SafeString( Titles.ComputeTitle( null, mob ) );
string female = ( mob.Female ? "1" : "0" );
bool pubBool = ( mob is PlayerMobile ) && ( ((PlayerMobile)mob).PublicMyRunUO );
string pubString = ( pubBool ? "1" : "0" );
string guildId = ( mob.Guild == null ? "NULL" : mob.Guild.Id.ToString() );
// ***********************
string bankaccount = (Banker.GetBalance(mob).ToString());
// ***********************
if ( Config.LoadDataInFile )
{
m_OpMobiles.Write( LineStart );
m_OpMobiles.Write( mob.Serial.Value );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( SafeString( mob.Name ) );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( mob.RawStr );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( mob.RawDex );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( mob.RawInt );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( female );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( mob.Kills );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( guildId );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( guildTitle );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( notoTitle );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( mob.Hue );
m_OpMobiles.Write( EntrySep );
m_OpMobiles.Write( pubString );
// ******************************
m_OpMobiles.Write(EntrySep);
m_OpMobiles.Write(bankaccount);
// ******************************
m_OpMobiles.Write( LineEnd );
}
else
{
// ***** Changes in this line too ****
ExecuteNonQuery("INSERT INTO myrunuo_characters (char_id, char_name, char_str, char_dex, char_int, char_female, char_counts, char_guild, char_guildtitle, char_nototitle, char_bodyhue, char_public, char_bankaccount ) VALUES ({0}, '{1}', {2}, {3}, {4}, {5}, {6}, {7}, {8}, '{9}', {10}, {11}, {12})", mob.Serial.Value.ToString(), SafeString(mob.Name), mob.RawStr.ToString(), mob.RawDex.ToString(), mob.RawInt.ToString(), female, mob.Kills.ToString(), guildId, guildTitle, notoTitle, mob.Hue.ToString(), pubString, Banker.GetBalance(mob).ToString());
}
}
|
|
|
|
|
|
|
#8 (permalink) |
|
Account Terminated
Join Date: Jun 2004
Location: Cincinnati, Ohio
Age: 20
Posts: 3,954
|
Web design takes a lot of time and practice. No one simply goes to sleep and wakes up the next morning as a world-class designer. Keep working on PHP and read some guides on color and you'll be set. I read Slash7 with Amy Hoy - Home, which has a few articles on color. The current new post and this one (Slash7 with Amy Hoy - Drop That Design! 6 Things You Need to Know About Color) are especially awesome.
![]() |
|
|
|
|
|
#10 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
|
php4 lacks quite a bit in OOP, however php5 is much much better. Now anything in a php document is global UNLESS it is declared in a function. So it doesnt matter if you use multiple <?php //code ?> within your html or use just one <?php //code ?> that spits out the html.
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#11 (permalink) |
|
Forum Novice
|
Aye, thanks. Got it working finally, it was the <td> & <tr> parts that was causing me a problem from the editor, thats why i needed something better i think. Plus the code needed to be cleaned up a bit too.
Anyway, it's here for your paroosing pleasure... Shard Millionaires My first attempt ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|