TinyPortal

Development => Support => Topic started by: JayT on May 13, 2006, 02:22:34 AM

Title: Custom Page (I know this has been asked but...)
Post by: JayT on May 13, 2006, 02:22:34 AM
Hey, I searched and didn't really find the answer to my question or maybe I did and didn't know it.

Anyways, I want to add a Website Top Ten List page. I have script up and running on my server but I am not sure how to get it integrated into TP. Below are the links and any help is greatly appreciated.

Site: http://www.legendsforums.com

Top Ten list script: http://www.legendsforums.com/clanwebsites/
Title: Re: Custom Page (I know this has been asked but...)
Post by: eldacar on May 13, 2006, 04:01:02 AM
The easiest way is to put the code in a PHP article.
Title: Re: Custom Page (I know this has been asked but...)
Post by: JayT on May 13, 2006, 04:36:31 AM
Yea, I seen that. I guess the problem is I don't know what code needs to go in there.
Title: Re: Custom Page (I know this has been asked but...)
Post by: bloc on May 13, 2006, 08:34:23 AM
What code is used to display what you have?

Usually its not much you need to convert for use in a php article/block.
Title: Re: Custom Page (I know this has been asked but...)
Post by: JayT on May 13, 2006, 01:12:07 PM
Here is the index.php code:
<?php
/* ---------------------------- */
// basic stuff
/* ---------------------------- */
require './global.php';
$site['title'] = $evoLANG['main'];

/* ---------------------------- */
// topsite class
/* ---------------------------- */
$content = $top->init_main();

/* ---------------------------- */
// generate page
/* ---------------------------- */
$page->generate();
?>


But that gives error messages. That it cant find the files to run the script. I changed the path for the global.php but that isn"t enough.

Through TP, it is looking for the files in the root. In the script all the paths are './blah.php'
Title: Re: Custom Page (I know this has been asked but...)
Post by: gerrymo on May 13, 2006, 02:58:47 PM
You'll get errors if you dont take out the php tags. Remove <?php and ?> (1st and last lines) and try again. A php article already know it's php, so doesnt need the tags.
Title: Re: Custom Page (I know this has been asked but...)
Post by: JayT on May 13, 2006, 03:27:08 PM
Yea, I done that. That is just the exact code from the index.php.
Title: Re: Custom Page (I know this has been asked but...)
Post by: gerrymo on May 13, 2006, 03:37:36 PM
I cant see what's wrong. Someone else probably will. In the mean time, there are a couple of things you could try.

php block/php article

include('path/to/file');


iFrame in a html/javascript block or standard article.

<iframe src="pathe/to/file" height="400" width="100%" scrolling="no" frameborder="0"></iframe>

(set the height to suit your needs)
Title: Re: Custom Page (I know this has been asked but...)
Post by: JayT on May 13, 2006, 08:06:53 PM
The iframe worked but it isnt really asthetic.

If the block could be opened in a seperate page it would be fine.
Title: Re: Custom Page (I know this has been asked but...)
Post by: gerrymo on May 13, 2006, 08:34:27 PM
Why not create a custom action to do the job for you? Follow the steps in this thread. You'll need to substitute some psrts for your own page type, but it's not too hard to do. I've done it with a Gallery and FAQ page on the same site. Takes a little bit of fiddling to get it right though.

http://www.simplemachines.org/community/index.php?topic=19518.0;all
Title: Re: Custom Page (I know this has been asked but...)
Post by: JayT on May 13, 2006, 10:39:14 PM
That gives the same errors as the article. It is obvious the script is what is screwing up.

http://www.legendsforums.com/index.php?action=ClanWebsites
Title: Re: Custom Page (I know this has been asked but...)
Post by: gerrymo on May 13, 2006, 11:35:04 PM
Does your file in sources (ClanWebsites.php?) look the same as this?


<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
ClanWebsites() {
// This is gonna be needed...
loadTemplate('ClanWebsites');
}
?>



You'll see that there are 2 changes to be made. Lines "Function" and "loadTemplate". I made this mistake, and got the same error you have. Be carefull with upper and lower case. I think this also can give erors.
Title: Re: Custom Page (I know this has been asked but...)
Post by: JayT on May 14, 2006, 01:28:19 AM
I got past that but it can't load the template. Attached is the template.

I got it. I had the wrong file name. "C" & "W" needed to be capitalized.

Thanks for your help!