DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • May 18, 2013, 04:59:43 AM
Home Forums News Links Downloads Login Register Advanced Search
* *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

  Show Posts
Pages: [1] 2 3 ... 63
1  Coding Support / Coding Support Desk / Re: preg_replace a <span> string? on: September 30, 2012, 11:27:14 AM
I'm stumped. Everything looks fine to me(like I said... new to preg_replace). Maybe someone more familiar with the function will look at this topic and be able to tell you why.
2  Coding Support / Coding Support Desk / Re: preg_replace a <span> string? on: September 30, 2012, 11:07:30 AM
I do notice that in your first stat variable doesn't start with a " mark. Though, if you didn't copy/paste from your script, that's not the issue. Also, are you grabbing the exact "{title}", or is that a placeholder for a different text? If it is exact, have you tried escaping the { and } with backslashes?

Quote
Code:
<?php
$stat 
= <span class='colWhite'>Crazy string</span> <span class='colRed'>is crazy</span>";
$stat = preg_replace("/\<span (.*?)\>/","",$stat);
$stat = preg_replace("%\</span\>%","",$stat);
output(
$stat)
3  Coding Support / Coding Support Desk / Re: preg_replace a <span> string? on: September 30, 2012, 10:59:55 AM
My bad. I forgot to escape one of the > characters. This is the adjusted version. If it doesn't work, then I apologize, as I only recently started to understand preg_replace.

Code:
output(preg_replace("/\<span(.*)\>(.*)\<\/span\>/is","\\2","<span class='coliceviolet'><b>First test!</b></span>"));
4  Coding Support / Coding Support Desk / Re: preg_replace a <span> string? on: September 30, 2012, 09:48:04 AM
Unlike str_replace, which does an exact search, preg_replace needs to be escaped like so.

Code:
output(preg_replace("/\<span(.*)>(.*)\<\/span\>/is","\\2","<span class='coliceviolet'><b>First test!</b></span>"));

That should work, however I have not tested it. It should output "<b>First Test!</b>". If you don't want the <b></b>, then just add the escaped tags around the second (.*).

:: EDIT ::
This should help you understand preg_replace a bit more(it helped me a lot). Yes, I know it's preg replacing bbcodes to html, but it still works. Smiley
http://www.talkphp.com/advanced-php-programming/2589-bbcode-using-preg_replace.html
5  Coding Support / Coding Support Desk / Re: Just a stupid moment in my life... re: commentary entry box size on: September 29, 2012, 05:18:02 PM
She wants a textarea box, though. I suggest taking a look at this: http://cburgmer.github.com/jquery-shiftenter/
6  Village Square / General Discussion Area / Re: Theme Poll on: September 29, 2012, 08:24:41 AM
@KaosKaizer
I don't believe anyone is running an Inheritance Sequence site currently... so it's an option...
I did notice you had taken Legend of the Blue TARDIS down... I had hoped it would work out... But I do remember a lot of ideas we had had for it. Should I choose to do it, I certainly would appreciate your help, along with that of several other of the more experienced mostly for translation and modification. Thank you for the offer.
I'd love to make my own theme, and see it be successful, however I don't feel my creativity is on that kind of level. Perhaps with a lot of guidance from one more so...

True.

Yeah, that got to be quite daunting simply because I was a little overambitious with the quantity and complexity of my ideas. I would be glad to help. Smiley We'd have to take it one step at a time, though, if we don't want to get overwhelmed. Personally, I'm getting stronger at coding each day. I've even taken on the task of trying to learn JavaScript. Cheesy

For your own theme, I think it is quite simple. Don't force the ideas. Instead, start with a very simple, almost too basic idea, then slowly work up from there. Let's use my example of Mecha. If you did decide to do that, you would most likely want it in the future, and the user controls the Mecha inside of battle. There's your basic idea. To build off of it, you might want to change "health" to "shield" to represent the Mecha's shield damage or something. Then, you might decide that you want to have ammo weapons, so you'd grab and modify the ranged weapons module(I forget what it's called now). Then, you might want to focus on the village. Maybe each village is a planet/colony/moon in its own right, and we'd have to travel through space using Mecha to get there. But wait, not all Mecha are the same, so maybe you write or get someone to write a script that allows users to modify their Mecha to their liking. Have different parts, allow them to paint, so on and so forth. That could inspire races to be the Mecha type, and specialties to be some sort of special "drive" installed in the Mecha to do certain power moves. You just gradually build -- make sure you save all the ideas somewhere.

Now, that's just an example. I'm not saying run off and do a Mecha LotGD (though... some of my ideas make me want to play one xD). Instead, come up with a new idea if you want and build off it, or find a partner that will help inspire you through their own ideas, if you feel you aren't creative enough.
7  Coding Support / Coding Support Desk / Re: Input changes between pages on: September 28, 2012, 02:00:57 PM
Glad to know it worked Smiley

For future reference, a hidden field is just a regular input tag, only it isn't seen. Like so:
Code:
<input type='hidden' name='oldvalue_gold' value='100orwhatever'>
8  Coding Support / Coding Support Desk / Re: Input changes between pages on: September 28, 2012, 11:02:09 AM
Have you tried a hidden input field for each of these that has the "old" values? That way, on form submission, compare input fields to the old values and if they don't match up, adjust them properly.

Or even getting the form values and compare them to the prefs before any change should work.
9  Village Square / General Discussion Area / Re: Theme Poll on: September 27, 2012, 06:17:42 PM
Personally, I'd say if something has already been done successfully and is still actively running, then stay away from that idea. The reason I say this is because look at how many Bleach and Naruto based sites fail simply because of Legend of Bleach and Shinobi Legends.

I do not think a DW based site has actually been tried(successfully), but if you decided to do this and were able to legally do it, I would be up for any translations and/or coding that it would require. I have tried to do this once myself, and I can tell you that it is a daunting task. If you do it, don't go at it alone because you will need a team of translators and coders just to get it just right.

Overall, I'd say yes, theme it, but don't theme it around any sort of series, whether they are books, tv shows, or movies. Basically, come up with a great idea all of your own and make it happen. I don't think too many modern or futuristic sites have been done, so there might be an idea for you. Mecha seem to be loved. Wink
10  Modules, Themes and other customizations for your game / Completed Forest, Village and Travel Events for Version 1.x.x / Re: Rabid Werewolf on: September 27, 2012, 03:55:58 PM
It's an extremely old topic. The site has been revamped since, and the "users" folders are gone. This is in the downloads list, though.
http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=248
11  Coding Support / Coding Support Desk / Re: Module Suggestion on: September 18, 2012, 04:31:27 AM
Well, yes, you could do that. My mind comes up with overly complicated solutions without even telling me of the simple ones, so... I didn't think of that xD
12  Coding Support / Coding Support Desk / Re: Module Suggestion on: September 14, 2012, 06:33:47 PM
Well, some servers are smaller so chats don't go by as fast. It is a thing that some servers would have, and others wouldn't, of course. Those that are too big might not want to have it.

As for modularizing it... I realized why I made it a core edit in the first place. The "viewcommentary" hook doesn't contain the comment ID and I can't do a query for $args['commentline'], as everything has already been appended there, including the delete button for staff, and the clan tags and names. I will tidy up my core edits and release them, unless somebody knows of a way to retrieve the ID of the comment from the viewcommentary hook.

:: EDIT ::
WARNING! Make sure that you are COMFORTABLE with making a core edit, and that you make a BACKUP of all files/tables that you will be editing. DragonPrime Staff is NOT responsible if your server crashes. I personally may try to help you if you make a mistake, so please, follow my words to a letter so you don't make a mistake.
You are going to need to place the attachment in your root folder. You are also going to need to create 2 new columns in your commentary table. Please note that if you upgrade, these columns will be removed(which is why I wanted to do this via module, that way there would be no need for extra rows...).
You can do so by running the PHP in RawSQL:
Code:
$sql = "ALTER TABLE `".db_prefix("commentary")."` ADD COLUMN likes int(11) NOT NULL default 0";
db_query($sql);
$sql = "ALTER TABLE `".db_prefix("commentary")."` ADD COLUMN dislikes int(11) NOT NULL default 0";
db_query($sql);

Then you need to modify your lib/commentary.php file with the following:
Code:
<?php
/* FIND LINE 424, it (and the 3 preceeding lines) should look something like, but with tabs:
if ($session['user']['superuser'] & SU_EDIT_COMMENTS) {
$out.="`2[<a href='".$return.$one."removecomment={$commentids[$i]}&section=$section&returnpath=".URLEncode($return)."'>$del</a>`2]`0&nbsp;";
addnav("",$return.$one."removecomment={$commentids[$i]}&section=$section&returnpath=".URLEncode($return)."");
}
*/
// Like/Dislike PREP
$id $commentids[$i];
$sql "SELECT likes,dislikes FROM ".db_prefix("commentary")." WHERE commentid=$id LIMIT 1";
$res db_query($sql);
$row db_fetch_assoc($res);
if (isset($session['user']['prefs']['comdislikes'])) $dislikes explode(",",$session['user']['prefs']['comdislikes']);
else $dislikes = array();
if (isset($session['user']['prefs']['comlikes'])) $likes explode(",",$session['user']['prefs']['comlikes']);
else $likes = array();
// Like code...
$lcount $row['likes'];
if (in_array($id,$likes) || in_array($id,$dislikes)){
$out .= "<img src='images/like.gif' width=10 height=10 alt='Like'> $lcount&nbsp;";
}else{
define("OVERRIDEFORCEDNAV",TRUE);
$out .= "<a href='likedis.php?op=like&id=$id&returnpath=".URLEncode($return)."'><img src='images/like.gif' width=10 height=10 alt='Like'> $lcount</a>&nbsp;";
addnav("","likedis.php?op=like&id=$id&returnpath=".URLEncode($return)."");
}
// End

// Dislike code...
$dcount $row['dislikes'];
if (in_array($id,$likes) || in_array($id,$dislikes)){
$out .= "<img src='images/dislike.gif' width=10 height=10 alt='Dislike'> $dcount&nbsp;";
}else{
define("OVERRIDEFORCEDNAV",TRUE);
$out .= "<a href='likedis.php?op=dislike&id=$id&returnpath=".URLEncode($return)."'><img src='images/dislike.gif' width=10 height=10 alt='Dislike'> $dcount</a>&nbsp;";
addnav("","likedis.php?op=dislike&id=$id&returnpath=".URLEncode($return)."");
}
// End
// END

Then, place the 2 images in the zip into your /images/ folder.
13  Coding Support / Coding Support Desk / Re: Module Suggestion on: September 14, 2012, 05:58:28 PM
I did make a like system for the commentary, however I have yet to release it as it was a core edit(my implementation could be fatal to a server if not done to a letter). If you want, I could try to make a module out of it, instead. Or I could release the core edits here. However, it did not send a message when someone liked a comment, and there was no limit. Beside the comment in the chat, it was just an upvote and a downvote button, with the number of likes and dislikes for each comment. I will work on making it a module for you, if those limitations are fine. Or I could try to make it a module and try to meet your wants, if you would prefer it that way. I originally did not make it send a message as I thought that would be too annoying due to the no per-day up/down voting limits.
14  Coding Support / Coding Support Desk / Re: Charstats Edit on: September 11, 2012, 05:02:56 AM
I realized an easier way and removed my code, replaced it with another smaller set that is even easier than editing one template. Just use it as a base. It's in my last edit, though I'll quote it...

[[[ removed ]]]

:: EDIT ::
Strike what I just said. I realized there is a much easier way. Just hook into everyfooter-loggedin, then do so:
Code:
global $template;
case "everyfooter-loggedin":
  $template['statrow'] = "<tr><td class='charinfo'><b>- {title}</b></td><td class='charinfo'>{value}</td></tr>";
15  Coding Support / Coding Support Desk / Re: Charstats Edit on: September 11, 2012, 04:55:10 AM
[[[ removed ]]]

:: EDIT ::
Strike what I just said. I realized there is a much easier way. Just hook into everyfooter-loggedin, then do so:
Code:
global $template;
case "everyfooter-loggedin":
  $template['statrow'] = "<tr><td class='charinfo'><b>- {title}</b></td><td class='charinfo'>{value}</td></tr>";
Pages: [1] 2 3 ... 63

*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
30 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search