News:

Wondering if this will always be free?  See why free is better.

Main Menu

Help with require code for counter

Started by Politicitis, October 22, 2005, 02:26:30 AM

Previous topic - Next topic

Politicitis

I'd like to put a counter on my forum to keep track of site stats. The script needs to have the following line on the php page I want to track.

require "/home/httpd/vhosts/politicitis.com/httpdocs/counter/counter.php";

I've tried putting it in the index.template.php as it is above and with <script language="php"> before it and </script> after it (as I've had to do in some other cases) but can't get it to work.

What do I need to do to get this to work?
Politicitis Political Roasting: www.politicitis.com

Host and designer of www.survivalistssite.com
Black SMF Theme in action: http://forum.survivalistssite.com

Elmacik

right after the first line of php file, try to put it like this:

require("/home/httpd/vhosts/politicitis.com/httpdocs/counter/counter.php");

and <script language="php"> doesnt make sense to me...
Home of Elmacik

Politicitis

Thanks, but that didn't work. I get an error when I put it after the first line, and anywhere else it just displays it as text. That line of code is suppose to go where you want the count from the script to be inserted.

I've found on a few php pages that it needs to have the <script language="php"> and the </script> need to be before and after the line of code for it to work right and not just be treated as text. Don't know why, but that is how it works.
Politicitis Political Roasting: www.politicitis.com

Host and designer of www.survivalistssite.com
Black SMF Theme in action: http://forum.survivalistssite.com

Elmacik

its displayed as text??
i think then, you arent working with php files and trying to add it to an HTML file.
try this then,

<?php require("/home/httpd/vhosts/politicitis.com/httpdocs/counter/counter.php");  ?>
Home of Elmacik

Politicitis

I am working with php files unless index.template.php isn't a php file.

That didn't work, didn't give any errors though.
Politicitis Political Roasting: www.politicitis.com

Host and designer of www.survivalistssite.com
Black SMF Theme in action: http://forum.survivalistssite.com

Elmacik

it really makes NO sense to me that require command displays as text...
i think you are putting it to a wrong place.. or maybe i am getting mad
Home of Elmacik

Politicitis

Thanks for all your help, no sense getting frustrated over it though. It makes no sense to me either which is why I posted wondering if anyone had any ideas.
Politicitis Political Roasting: www.politicitis.com

Host and designer of www.survivalistssite.com
Black SMF Theme in action: http://forum.survivalistssite.com

Elmacik

btw, i think for a counter, its useless to use require, i think you should use include instead
Home of Elmacik

Politicitis

I tried using include instead of require, didn't make a difference.
Politicitis Political Roasting: www.politicitis.com

Host and designer of www.survivalistssite.com
Black SMF Theme in action: http://forum.survivalistssite.com

Elmacik

could you please send the relevant code that displays as tex?
you can post the first 5-10 lines of your index.template.php file.
Home of Elmacik

Politicitis

I was just trying out all the different versions so that I could post all the variations. I got one to work, not quite right, but I was able to fix it. For every suggestion you gave me I tried it 3 ways. I don't know why or how it is working, but it did. And it was the very first thing I tried as well... changing require to include.

* Politicitis grumbles alot, scratches head, "Dumb @$^%$!#%$^$^%^$#_)(&  I did it that way three times before!"

Thanks for all your help. One thing I did find, is that I was able to stick the line of code anywhere between a "table;" and a "///" I don't know if I typoed somewhere or it didn't upload right or what before, but it is doing what I want with a work around.
Politicitis Political Roasting: www.politicitis.com

Host and designer of www.survivalistssite.com
Black SMF Theme in action: http://forum.survivalistssite.com

Elmacik

Home of Elmacik

Politicitis

yeah well, I messed something up in there too. Without your replies and help I wouldn't have tried every variation ... and it wouldn't have ended up working. Besides, I also learned a couple of things :)
Politicitis Political Roasting: www.politicitis.com

Host and designer of www.survivalistssite.com
Black SMF Theme in action: http://forum.survivalistssite.com

Advertisement: