Where do I find . . . ?

Started by Porty, September 26, 2006, 12:31:27 PM

Previous topic - Next topic

Porty

SMF Version: SMF 1.0.8
I want to write a little script to insert a value in a link depending on what the name of the board is. What I can't find is the file where that info is stored. I am looking for the value(s) for $category['link'], if anyone could point me in the right direction, I would be most grateful.

Thanks.

Oldiesmann

Take a look at Sources/BoardIndex.php - that should help.
Michael Eshom
Christian Metal Fans

Porty

Thank you. I appreciate the help.

Porty

Follow up: what I am looking for is the file that says, for example:
board 1 = "Abdomen Bench"
board 2 = "Acne"
etc.
Where can I find that? I don't want to edit it I just want to see what the values are so I can do an if . . . else in my code.

Thanks.

jacortina

The board names are stored in the database.

You can see them all displayed if you go to Admin => Forum(menu)/Boards. The 'move' links to the far right will have URL's like "...?action=manageboards;sa=board;boardid=2". That 'boardid' is the board number (reflects board creation order and not order in which displayed) and is probably the better way to target a specific board (as you can change the text).

Porty


Porty

I cannot find Forum(menu)/Boards in my Admin panel. I see

Forum Controls
Administration Center
Support and Credits
Edit Forum News
Manage Boards
Package Manager
Attachment Manager
Forum Configuration
Edit Features and Options
Edit Server Settings
Current Theme's Settings
Theme and Layout Settings
Smileys and Smiley Sets
Edit Censored Words
Edit Registration Agreement
Member Controls
Edit Membergroups
Edit Permissions
Register New Member
View/Delete Members
Set Reserved Names
Email Your Members
Ban Members
Maintenance Controls
Forum Maintenance
View Forum Error Log

Can you help? Thanks.

jacortina


Porty

Thank you for the replies.

I am a bit stuck - I am a php dummy . . .

I am passing the variable to the function like so:
board_links(ID_BOARD)
in my code.
When I get it into the function and go
echo $boardid;
I get the name of the board i.e. Warts or Arthritis
I have an if . .  else checking to see what the value of the $boardid is but I always get an error.
if ($boardid == "Warts")

I would appreciate any help and thanks in advance for your patience.

:-)

jacortina

Sounds like another reason to use the board number (ID_BOARD) ;)

Exactly what is the error that you get? What's the full if clause?

Porty

I hadn't written it yet, I just wanted to make sure I was checking the right thing first. What it will do is to see what board is being displayed and insert a link back to the original website to the category that the person came to the board from.

So it was pretty much just checking what was coming through.

jacortina

Even in testing, if an error is coming up right after you echo out the value, I'd be interested in what the error was.

Porty

When I have
echo $boardid;
in the function, it all works fine. But when I put
if ($boardid == "Treadmill")
I get that template parse error.

Any ideas?

jacortina

That indicates something's not right in the code itself. It's not even getting to the point where it's evaluating the expressions or the 'if' test (it can't until it parses the code). Mismatched brackets, missing line terminators, that sort of thing.

Porty

This is what is in my code exactly:
function board_links($boardid)
{
        //Check to see which board we're at
        if ($boardid=="Treadmill")
        echo $boardid;
       //if ($boardid == "Warts")
        //    echo '<a href=\"http://www.besthealthproductsinamerica.com/warts.htm\">' $boardid '</a>';
       //else
       //    echo 'NO';

}


I haven't figured out yet how to do the link, but it is commented out so I don't know why it is giving the error.

jacortina

Is this enclosed between <?php  and  ?> ?

You don't need to escape the double-quotes when the string itself is single-quoted and you need to either concatenate the echo parts (with periods, '.') or make them separate 'arguments' by putting commas between them:

echo '<a href="http://www.besthealthproductsinamerica.com/warts.htm">'.$boardid.'</a>';
or
echo '<a href="http://www.besthealthproductsinamerica.com/warts.htm">', $boardid, '</a>';

Porty

Yes, I added this just before the closing ?> in the BoardIndex.template.php file.

I didn't think I had to escape the double-quotes, but was trying anything to figure out where the error was coming from. :-)

Thanks for the info about concatenation - I will try that.

Porty

It is still not working. I put an echo statement so I could see what is being received by the function, but the check for the value of the variable always fails. Any idea why?

My code:
function board_links($boardid)
{
        //Check to see which board we're at
        //if ($boardid=="Treadmill")
       echo $boardid;
       if ($boardid == "http://besthealthproductsinamerica.com/smf/index.php#44")
            echo 'YES!';
         //   echo '<a href="http://www.besthealthproductsinamerica.com/warts.htm">'.$boardid.'</a>';
       else
           echo 'NAH';

}

You can see I did some changes in desperation . .  :-)

TIA

jacortina

No parse errors, though, correct? But the passed in value (which you now KNOW is getting in) isn't matching the values you're check, right?

I'm a bit stumped. There's not much I can think of that could be wrong with a simple equality check for you to 'fix'.

Porty

Right. That is what I can't understand.

What I am passing to the function is $category['link'] - could you think of something else to send to the function? I couldn't figure out the ID_BOARD thing.

Advertisement: