TinyPortal

Development => Support => Topic started by: houston on November 04, 2005, 04:35:47 PM

Title: Inserting snippet codes
Post by: houston on November 04, 2005, 04:35:47 PM
Am I to assume that one would insert the snippet code into the TPortalBlocks.templates.php. And if so, does it matter where you insert the code.

Inquiring minds need to know.
Title: Re: Inserting snippet codes
Post by: bloc on November 04, 2005, 05:37:45 PM
No, snippets code are to be put into a php-type of block. So its actually stored in the database, not in the files.
Title: Re: Inserting snippet codes
Post by: houston on November 05, 2005, 12:36:24 AM
Quote from: Bloc on November 04, 2005, 05:37:45 PM
No, snippets code are to be put into a php-type of block. So its actually stored in the database, not in the files.

Are you refering to the Mysql database associated with the smf forum itself?
Title: Re: Inserting snippet codes
Post by: JayBachatero on November 05, 2005, 01:31:43 AM
No you add a new block.  when they ask you what type you select php.  insert the code that was provided to you.
Title: Re: Inserting snippet codes
Post by: houston on November 05, 2005, 06:01:25 AM
Quote from: JayBachatero on November 05, 2005, 01:31:43 AM
No you add a new block.ÂÃ,  when they ask you what type you select php.ÂÃ,  insert the code that was provided to you.

My eyes have been opened and the world is before me. Thanks JayBachatero
Title: Re: Inserting snippet codes
Post by: JayBachatero on November 06, 2005, 03:22:49 AM
Quote from: houston on November 05, 2005, 06:01:25 AM
Quote from: JayBachatero on November 05, 2005, 01:31:43 AM
No you add a new block.  when they ask you what type you select php.  insert the code that was provided to you.

My eyes have been opened and the world is before me. Thanks JayBachatero


You welcome.
Title: Re: Inserting snippet codes
Post by: conradk on January 11, 2006, 03:24:38 PM
Can someone give me an example of a php bock code snippet. I am trying to integrate coppermine into smf/tp and am getting php errors when trying to use the php block. (SMF1.1RC1)
Title: Re: Inserting snippet codes
Post by: borgBOB on January 11, 2006, 03:34:56 PM
Just read the other posts in this thread, most are phpblocks! Calendar, clocks, ect.
Title: Re: Inserting snippet codes
Post by: conradk on January 11, 2006, 06:42:00 PM
Sorry, should have been more specific... Can anyone show me how the php code appears inside the php block? I am getting a php parsing error.
Title: Re: Inserting snippet codes
Post by: IchBin on January 11, 2006, 08:18:39 PM
Just remember to exclude the <?php and ?> tags in your script. You don't need those.
Title: Re: Inserting snippet codes
Post by: core on January 15, 2006, 10:44:15 PM
or open/close em properly like:

*start empty php block*

*close php as phpbloc has a open php precoded in it*
?>

*put in some html*
<img src="image source"><div align="center">and here comes the fabulous php block!</div>

*open php*
<?php

*put in some php*
thafabulousphpscript\}{as you see I dont know php/?||echo echo : 'lol';

*close php*
?>

*some more html below*
<img src="image source"><div align="center">the end the fabulous php block!</div>

*open php again because the php bloc has a close precoded in it*
<?php




please edit my post if I made a mistake about this :)
Title: Re: Inserting snippet codes
Post by: Rasyr on January 15, 2006, 11:00:34 PM
shouldn't need to open and close them like that as you can just use echo to write out the html code portions...

So, your example would look like this:

echo '<img src="image source"><div align="center">and here comes the fabulous php block!</div>';

thafabulousphpscript\}{as you see I dont know php/?||echo echo : 'lol';

echo '<img src="image source"><div align="center">the end the fabulous php block!</div>';

Title: Re: Inserting snippet codes
Post by: core on January 16, 2006, 06:46:48 PM
ok, thnks for the tip!


*I am a php n00b!