Web Developers Disagree (amusing)

May 16th, 2008

  Here is a blog I came across at Wordpress.org when I was looking up some Wordpress configurations…I found it amusing…

  1. dalecom

    Hello if you look here - http://www.allpokerworld.com/
    The categories list has the numebr of posts below the cat name. This is because the number of posts (1) etc is outside the li tag.
    What file do I have to edit to correct this ?

    Thanks a lot

  2. moshu

    style.css

  3. dalecom

    No its not that - the number of posts : (1) bit of html is outside the li tags - I need to know which file this is located in so I can move it inside them.

    Thanks.

  4. moshu

    Well, if you know better, don’t ask.
    It has been asked 100 times, I always give the same answer. It worked for others… but you can try whatever you want.

  5. dalecom

    Im not using a default template, my css is from scratch so I know for a fact its not in style.css.
    This is an html problem which is why I asked which php file I need to edit to bring it inside the li tags.

    Anyone else have any ideas ?

  6. moshu

    I know for a fact its not in style.css.

    You know nothing. I’ll not argue, and I won’t even tell you how to correct it… Be happy with your knowledge :)

  7. dalecom

    No need to be like that is there, I’d expect better from a moderator.
    If you do a view source on my code you will see the problem is with the html, not css.

  8. moshu

    The moderator gave you an answer in 14 minutes after you posted your question. Actually, the correct answer.
    If you didn’t know what to edit in the stylesheet, you should have asked.
    You chose to argue… The moderator doesn’t like people who argue without trying the solution they were offered.

    The moderator can see not only your source code but also, using the Dev Toolbar, is able to change/edit your stylesheet on the fly to check that the solution offered works. It works.

    Change the display: block to display: inline.

    And next time don’t be lazy, do a search before posting, your question has been answered many times.

  9. deanhatescoffee

    This thread makes me giggle a little. ;)

  10. dalecom

    Yes I know that way would put the number of posts on the same line, it also mucks up the 1px border I have under each li by making them uneven lengths - ie the same length as the text rather than a set width, which is why I want to edit the html to put them within the li tag.

  11. moshu

    You cannot edit the html, and you should know that if you know everything better. That list is generated, it is not hardcoded.

  12. dalecom

    sigh

    Yes and I am asking in which php file the html is generated

  13. dalecom

    Its ok, have found it.
    If anyone else has this problem and doesnt want to deal with these useless moderators,
    You need to edit wp-includes/template-functions-category.php

How to add Comment Engine functionality to phpBB

May 16th, 2008

How to add Comment Engine functionality to phpBB for any page on your site.

Being that my other website (www.Blazedent.com) likes to offer a community-like feel to the online visitors, I am compelled to offer plenty of options for the public when it comes to posting what they have to say. The first way of doing this was using phpBB so that we could offer our Message Boards system. The second was offering a Resource Directory where viewers could submit websites. The next step was to offer a much needed commenting system where users could post their thoughts onto any page of the site. Here is the tutorial for how we accomplished what we did. See an example of the ArtisticGenesis.com phpBB Comment Engine mod here. (go to the bottom of the page) .

1. Install phpBB and ensure that it is running correctly. (phpBBinstallation instructions/guide)

2. Install the phpBB Fetch All mod into your phpBB/mods section and ensure that it is running correctly. (phpBB Fetch All installation instructions/guide)

3. In ‘phpBBpath/mods/phhpbb_fetch_all/posts.php’…

EDIT:

$CFG[’posts_limit’] =

TO:

$CFG[’posts_limit’] = 0; // 0 = unlimited or all posts

4a. Create a custom phpBB Fetch All page for your site to include. The mod includes example pages in the ‘phpBB/mods/phpbb_fetch_all/examples’ folder. The easiest way to make your own is to copy the code out of that page and edit it. I believe a good template to use is phpBB Fetch All’s include example.php page.

4b. In your customized phpBB Fetch All page…

BEFORE:

//
// disconnect from the database
//

ADD:

// ArtisticGenesis.com Comment Mod

// note that in $PageCommentID != ” the ‘ and ‘ are two separate apostrophes that are placed together

if ( $PageCommentID != ” ) {

$topic = phpbb_fetch_thread($PageCommentID);
}

4c. Include your customized phpBB Fetch All page into the pages on your site that you want comments on. The best way to integrate phpBB Fetch All into your website is to include it using the php include method “include(’To Root/phpBB/mods/phpbb_fetch_all/Custom phpBB Fetch All Page.php‘);”. Be sure that the include path to the phpBB Fetch All file is a relative path (ie. ‘../../’ not ‘http://www.yoursite.com/path/’).

5. Include a comment form either in your customized phpBB Fetch All page, or using some other method by inserting the following into the pages you want people to be able to leave comments on.

<!–// ArtisticGenesis.com phpBB Comment Mod //–>

<form action=”relativeroot/phpBBpath/posting.php” method=”post” name=”post”>

<table width=”100%”><tr><td width=”150″>
Enter your comment:
</td><td>
<textarea name=”message” rows=”2″ cols=”35″ wrap=”virtual” style=”width:100%” tabindex=”3″ class=”post”></textarea>
</td></tr><tr><td>
<input type=”hidden” name=”t” value=”<?php echo $PageCommentID; ?>” />
<input type=”hidden” name=”mode” value=”reply” />
<input type=”hidden” name=”blaz” value=”<?php echo $PageSource; ?>” />
</td></tr></table><center>
<input type=”submit” accesskey=”s” tabindex=”6″ name=”post” class=”mainoption” value=”Post Comment” <?php if ($userdata[’session_logged_in’]) { echo ”; } else { ?>onClick=”return validateForm()”<?php } ?>/>
(logged in as <i><?php if ($userdata) { ?>
<?php if ($userdata[’session_logged_in’]) { ?><?php echo $userdata[’username’]; ?><?php } else { ?>
<?php echo $lang[’Guest’]; ?><?php } ?><?php } ?></i>)</center>
</form>

6. Lastly, at the beginning of the pages you want to include comments on you need to add edit and add 2 important variables.

// ArtisticGenesis.com phpBB Comment Mod

// in $PageSource = ‘..’ the .. represents that relative path to the root of your website. (ie. http://www.artisticgenesis.com/ resourcedirectory/home/ index.php would be ‘../../..’ . Be sure not to include a trailing slash)

$PageSource = ‘..’.$_SERVER[’PHP_SELF’];

// $PageCommentID is equal to the topic number in your phpBB forum. To make a comments page you must first make a thread in your forum for every unique comment section you want. After creating a thread, go to your forum’s index, navigate to the thread, in the address bar you will see t=SOME#, the number that t equals is the topic number for that thread and the same number that you want to use as your $PageCommentID number.

$PageCommentID = ‘551′;

That’s all that you need to do. I admit that I should make an official guide to doing this and probably include some downloadable example files…but this is what I’m starting off with. If anyone wants more information or has questions, feel free to post them. See an example of the ArtisticGenesis.com phpBB Comment Engine mod here (go to the bottom of the page) .

ArtGen WP Fetch v1.1

May 16th, 2008

What exactly does it do?
It gets the latest entry from a WordPress blog and puts its post, url and title in friendly and easy to use php variables. The best aspect of it is that it can be installed and used from any directory on your site, or even from a different server altogether, it does not have to be in the WordPress directory. It is easy to configure and install, just see the readme.txt file. It also has a truncate feature that allows you to display as much or little of the post as you want.

Key Points:
Install and use from any directory on your site, even outside of the WordPress directory.
Easy to configure, install and implement.
Very customizable.

Let me know of any bugs or additions that you find for it…any and all feedback is welcome.

Download: Download: ArtGen WP Fetch v1.1

Javascript Form Validator

May 16th, 2008

Alright, so I just had to make a form validator in Javascript (js) for an html form. I had to go to a couple of different websites to find all of the information I needed, therefore I see it beneficial to display it all on one page.

Note that this method stops a form from being processed and calls upon a pop up box with a user selected message noting that certain items are incorrect in the form.

In the <head> of your page add this:

<script type=”text/javascript”>
// form validator
function validateForm() {
// setup variables
var errors;
var toalert;
toalert = “”;

// use this type of method for checkboxes and radio buttons
// notice the .checked at the end, also notice the [0] that represent each available radio button starting with 0

if ( ( document.testform.qty[0].checked == false ) &&
( document.testform.qty[1].checked == false ) &&
( document.testform.qty[2].checked == false ) &&
( document.testform.qty[3].checked == false ) ) {
// if none of the radio buttons are chosen this is the message that will be displayed
toalert = toalert + “You must select a quantity. “;
errors = “true”;
}

// this is the method we use for text boxes
// notice the .value at the end of the form field name
// note that you cannot include a - in the name of your field name, js doesn’t like it
// note that if you want to check on a number that is in an input box you’ll have to convert it from a string to an int
// do this using parseInt( )

if ( document.testform.dateseldd.value == ” ) {
// message to display if input box is blank
toalert = toalert + “You must select a date that your coupon expires. “;
errors = “true”;
}

if (errors == “true”) {
alert(toalert);
return false;
}
if (errors != “true”) {
document.testform.submit();return false;
}
}
</script>

Now just add this to you submit button on your form:
onclick=”validateForm();”

That’s it, pretty painless.

ASP Intro

May 16th, 2008

Well, I’ve just written my first ASP page. Being a PHP junky I found it irritating and rather odd that a single quote (’) starts a comment. Wouldn’t that be the last choice for commenting syntax? I mean, working html, css, and javascript all in one usually require you to use single and double quotes often.

Either way, I didn’t find it too difficult to convert my PHP into ASP. Here are a few things I learned along the way that may save other noobs like myself some time.

Set a variable:
Dim var1

Define a variable:
var1 = “this info”

Comment:
‘ this is dumb syntax for commenting

if then, substring search:
‘ note that request.querystring(”username”) is an input POST from a form
if inStr (request.querystring(”username”),”=”) then risk = “true”

Set a cookie:
‘ this cookie will expire in 15 minutes
response.cookies(”cookiename”) = “my cookie info”
response.cookies(”cookiename”).expires=dateadd(”n” , 15, Now())

Get a cookie:
request.cookies(”cookiename”)

Output alot of html:
<%
if var = “true” then
%>
This<br>
is alot of <b>html</b>
<%
end if
%>

By the way, this is the first post of many to start my new blog about primarily coding and computer issues. My name is habit and I’ll be your script junky for the evening.