Jump to content

toasty

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

toasty's Achievements

Member

Member (2/5)

0

Reputation

  1. In hind sight, 2-3 hours would have been pretty good given that I spent about 10 hours yesterday troubleshooting a (rather nice) javascript that was able to achieve what I was looking for.  It's nice having one more milestone behind me.  Thanks for the links though Huggie, I took a look at the W3 link and have a feeling I'll have use for it at some point; at the very least it's something to add to my arsenal. Thanks!
  2. The URL code is being annoying for some reason, here's the link: http//www.frequency-decoder.com/2006/09/16/unobtrusive-table-sort-script-revisited
  3. [b]Edit - Got the code from the developer[/b] I need some help modifying a script I've come across from [url=http://www.frequency-decoder.com/2006/09/16/unobtrusive-table-sort-script-revisited]here[/url].  It's a great script that allows for dynamic table sorting, my challenge is that it really screws up the appearance of my table which is very reliant on CSS.  Basically what's happened is that every [b]th[/b] that I've designated as [color=green]class="sortable"[/color] (as per the script) is having the CSS's formatting overwritten.  Through looking over some of his sample code I've determined that if I can create a sortable function I can use CSS to customize it. Example: Instead of using [color=green]class="sortable"[/color] to sort a numeric column I can create a function that does exactly the same thing but name it [color=green]class="sortable-sortNumber"[/color] and then in CSS I can customize it by using [color=green]th.sortable-sortNumber[/color]. The problem is that I have no idea, even after looking through his code, on how to create my own functions (two for numeric, two for text, one for date).  All these features are present however I need to [b]create five new functions so I can customize them[/b]. Here's an example of one of his "custom sort functions" for an IP address. [code]/*   sortIPAddress   -------------     This custom sort function correctly sorts IP addresses i.e. it checks all of the address parts and not just the first.   The function is "safe" i.e. non-IP address data (like the word "Unknown") can be passed in and is sorted properly. */ function sortIPAddress(a,b) {         var aa = a[fdTableSort.pos];         var bb = b[fdTableSort.pos];         return aa - bb; } function sortIPAddressPrepareData(tdNode, innerText) {         // Get the innerText of the TR nodes         var aa = innerText;         // Remove spaces         aa = aa.replace(" ","");         // If not an IP address then return -1         if(aa.search(/^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$/) == -1) return -1;         // Split on the "."         aa = aa.split(".");         // If we don't have 4 parts then return -1         if(aa.length != 4) return -1;                 var retVal = "";                 // Make all the parts an equal length and create a master integer         for(var i = 0; i < 4; i++) {                 retVal += (String(aa[i]).length < 3) ? "0000".substr(0, 3 - String(aa[i]).length) + String(aa[i]) : aa[i];         }                 return retVal; }[/code] If it helps at all here's the actual script itself in the attachment.  I know what I'm trying to do is bound to be simple as hell... I just don't know a lick of Java and I need this done in the next couple days on top of a bunch more site coding I'm working with.  Thanks a ton for any help you can spare :D [attachment deleted by admin]
  4. I'm not exactly sure if this is the right location for this post, so my appologies if it belongs elsewhere :) I'm wondering if anyone might know of a prebuilt script that I can use to do the following: There are two things I want to do: (1) Make the data in a table on one of my pages sortable. (2-optional) Update/enter the data in a MySQL database. Currently I have a page on my site that displays data in a table consisting of five colums that include values of text (including an href), numeric/decimal, and date.  Right now, whenever I need to update the table I have to add a new row and populate the colums with their data (via html).  All the info is housed [b]on that webpage[/b]. This seems like it should be something fairly simple, however I'm having a hellofa time finding a prebaked database/script to impliment at least one of these features.  If I had the time I would learn how to code it all myself, but I'm looking at a time frame of a couple days before I need it online. Does anyone have any ideas of a script that, at the very least, would do the table sorting?  Preferably handling the database as well (though optional, like I mentioned).  Did I mention "free" would also be a nice feature? :D  I've searched online and found a few that handle the sorting but their coding seems a bit off and usually ends up screwing up the java on the rest of my page. I'm open to any thoughts or suggestions and I really appreciate even the most miniscule amount of help :)
  5. [COLOR=Blue][size=4]Yes!!![/size][/COLOR] PrintF, you were right on the money!  I had to search around a bit and I found two files that called that function; it took me about fifteen minutes of looking around and figuring out the correct variable.  Once I updated all the function calls it was [i]nearly[/i] working; instead of returning any errors it was simply returning a ID value of null.  I looked around and some of the other code in one of the files where the function was being called and rolled the roulette on [COLOR=Green]$comicID[/COLOR] instead of $comic_id and it all fell into place perfectly.  Every post on every page points to the correct comic. I'm so pumped, thanks again PrintF, my site's now a hair's width from being done and smokin'. Woo Hoo!
  6. Hey Printf, thanks for the suggestion - though unfortunately I'm still getting the same error.  [code]Warning: Missing argument 8 for formatnewspost() in /var/www/html/smcomikaze/includes/classes/newsDO.class.php on line 48[/code] What you suggested makes sense though, the variable inside the function call (which is the 7th) must also appear as the 7th variable in the code as well.  Though it seems like it's still had the same effect... phoey.  [b]Edit - [/b] Something I just now noticed is that dispite returning that error message on the webpage, the {COMIC_ID} is returning a value of "1"; however in this specific example it [i]should[/i] be returning a value of "6" as that is the ID number of the corresponding post. I was totally surprised to get a response to my post so soon; if you've any other ideas, I'm all ears (so to speak).  Thanks Printf, and anyone else who feels like dumping some thoughts my way.  ;D Oh, and just incase anyone feels like spending the time on it, here are the actual newsDO.class.php and news_print.tpl files if you're feeling [b]that[/b] benevolent to skim through them; thought I totally don't expect it. [attachment deleted by admin]
  7. I need a solution to what's bound to be a really simplistic problem.  I'm running a php/mysql script on my site and one of the functions it performs to display a news/text post and dynamically link it to a corresponding image file.  If you're thinking "webcomic" you're right on the money.  The news posts are formatted according to a [b].tpl[/b] file. The script itself is [url=http://www.comikaze.org]Comikaze[/url] and I've tried contacting the creator, but I've not heard anything back for quite some time and after several attempts. The thing I need help with is that I need to insert a link into that .tpl [color=red](news_print.tpl)[/color] file that will dynamically link from the news post to the corresponding image page.  I've discovered that simply inserting PHP into the news_print.tpl file does [b]not[/b] work.  What I thought I'd do would be to define a new variable that I'd be able to use inside the news_print.tpl file. Variables that already exist are [color=red]{NES_AVATAR}, {NEWS_POST}, {NEWS_DATE}, {NEWS_POSTER}[/color], and a few others. The variable I need is already used by the script elsewhere as [color=blue]$comic_id[/color]; the comic rotation/navigation uses it to, well "navigate."  However how to turn it into something that news_print.tpl can use... that's what I'm not sure about.  I did some serious digging and I found this specific file that looks like it has to do with the news_print.tpl, and is called [color=red]newsDO.class.php[/color].  Inside the code on line #48 begins the following code:[code=php:0]function formatNewsPost($poster,$email,$avatar,$title,$post,$time,$nl2br) { $post = $this->nl2brNewsPost($post,$nl2br); if (!empty($avatar)) $avatar = "<img src=\"$avatar\" alt=\"$poster\" border=\"0\" />"; $replace['{NEWS_POSTER}'] = $poster; $replace['{NEWS_EMAIL}'] = $email; $replace['{NEWS_AVATAR}'] = $avatar; $replace['{NEWS_TITLE}'] = $title; $replace['{NEWS_POST}'] = $post; $replace['{NEWS_DATE}'] = $time; return $this->_common->getTemplate('news_print.tpl', $replace); }[/code] I thought that if I added [color=blue]$comic_id[/color] into the function call on the first line and the [color=blue]$replace['{COMIC_ID}'] = $comic_id;[/color] down with the rest that this would allow me to use [color=red]{COMIC_ID}[/color] as a variable with the news_print.tpl file.  Unfortunately, all it does when I attempt to use it is spits out this error: [code]Warning: Missing argument 8 for formatnewspost() in /var/www/html/smcomikaze/includes/classes/newsDO.class.php on line 48[/code] My website is essentially done, this is the last bit of code I need to wedge into it and *poof* off it goes.  Once I can get this to work it's keg time! Thanks to anyone who's taken the time to read this over!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.