Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Addons

Post Reply
 
Thread Tools
  #1  
Old 04-23-2006, 11:09 AM
SeLeCta Offline
pp regular
 
Join Date: Dec 2005
Location: Germany
Posts: 22
Send a message via ICQ to SeLeCta
addon: Radom Link On Comment Page (After Entry)

Hey guys,
can anybody say me why:
a) this script hasn't it own <div> in the admin/addons panel
b) why, when it's turned on, the form is displayed on the main page? how can I stop it?

What did I make false?

(the addon is just a beta, needs to be finished)

Code:
<?php
/*

Pixelpost version 1.5 BETA
Radom Link On Comment Page (After Entry) v 1.0
by Peter Schmidt
http://www.wait-a-second.de
peter@wait-a-second.de

*/

$addon_name = "Radom Link On Comment Page";
$addon_description = "Description follows.<br /><br />";
$addon_version = "1.0";


echo"<br /><br /><form action=\"index.php?view=addons&amp;x=radomlink_cmmtpage&mode=makenewblog\" method=\"post\">\n
      <input name=\"url\" value=\"http://www.fooblog.com\">\n
       <input name=\"linkname\" value=\"Link-name goes here\">\n
       <input type=\"submit\" name=\"Submit\" value=\"Add\"><br />\n
       </form>";
if($mode == 'makenewblog'){
$sql = "INSERT INTO pp_favblogs (`url`, `linkname`) VALUES ('$_POST[url]', '$_POST[linkname]')";
mysql_query($sql) or die(mysql_error());
}

$sql2 = "SELECT * FROM pp_favblogs LIMIT 1";
$result = mysql_query($sql2);
while($row=mysql_fetch_array($result)) {
                   $url = $row[url];
                   $linkname = $row[linkname];
$output= "<a href=\"$url\" title=\"$linkname\">$linkname</a>";
}
$tpl = ereg_replace("<RADOMLINK_CMMTPAGE>",$output,$tpl);
?>
Reply With Quote
  #2  
Old 04-23-2006, 11:32 AM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
are you saying you want to have the form in your admin panel rather than on the front page?
Reply With Quote
  #3  
Old 04-23-2006, 11:50 AM
SeLeCta Offline
pp regular
 
Join Date: Dec 2005
Location: Germany
Posts: 22
Send a message via ICQ to SeLeCta
yeah, I just want the form to have it in the admin panel, not at the front page!

how can I stop displaying on the front page?
Reply With Quote
  #4  
Old 04-23-2006, 12:12 PM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
ideally you need to create an admin addon. there is documentation on creating an admin addon in the docs for 1.5 download - have a look - you've written all teh code so turning it into an admin addon won't be hard for you.
Reply With Quote
  #5  
Old 04-23-2006, 02:06 PM
SeLeCta Offline
pp regular
 
Join Date: Dec 2005
Location: Germany
Posts: 22
Send a message via ICQ to SeLeCta
Thanks for your help. I already could manage that it is only shown in the admin -> addons panel. You can install it (just upload a file named admin_radomlink_cmmtpage.php with the following code) for testing what I writting next: The form is displaced in the above's addon <div>, but the text of this addon is in its own <div>.
(This is not the final version, because it does need an table at a mysql database, a one-click-installscript will be written!)



ATTENTION: I posted a 'new' code, the last on did not work, nothing were displayed when the tag were used. now it works, but the random selection not.

ATTENTION #2: The code is fixed. random selection works now.

Code:
<?php
/*

Pixelpost version 1.5 BETA
Radom Link On Comment Page (After Entry) v 0.1
by Peter Schmidt
http://www.wait-a-second.de
peter@wait-a-second.de

*/

$addon_name = "Radom Link On Comment Page";
$addon_description = "You can add in the Admin panel your favourite (Photo-) Blogs, and one of them will be<br />
randomly shown. This addon is created to get some spice in the after-comment-pages.<br />Tag is:<br /> &lt;RADOMLINK_CMMTPAGE&gt;";
$addon_version = "1.0";

if( isset( $_GET['view'] ) && $_GET['view']=='addons' ){
echo"<form action=\"index.php?view=addons&amp;x=radomlink_cmmtpage&mode=makenewblog\" method=\"post\">\n
      <input name=\"url\" value=\"http://www.fooblog.com\">\n
       <input name=\"linkname\" value=\"Link-name goes here\">\n
       <input type=\"submit\" name=\"Submit\" value=\"Add\"><br />\n
       </form>";
if($mode == 'makenewblog'){
$sql = "INSERT INTO pp_favblogs (`url`, `linkname`) VALUES ('$_POST[url]', '$_POST[linkname]')";
mysql_query($sql) or die(mysql_error());
}
}
$sql2 = "SELECT * FROM pp_favblogs order by rand() limit 0,1";
$result = mysql_query($sql2);
while($row=mysql_fetch_array($result)) {
                   $url = $row[url];
                   $linkname = $row[linkname];
$output= "<a href=\"$url\" title=\"$linkname\">$linkname</a>";
}

$tpl = ereg_replace("<RADOMLINK_CMMTPAGE>",$output,$tpl);

?>
Reply With Quote
  #6  
Old 04-23-2006, 05:31 PM
SeLeCta Offline
pp regular
 
Join Date: Dec 2005
Location: Germany
Posts: 22
Send a message via ICQ to SeLeCta
mh the next problem is:
This can't be added to the "after-comment-page" as easy as I though. You've to open index.php and find the lines for the "after-comment-page", but this doesn't work, too. I think it would work if the inclusion of the addons would be before that, but I don't believe users who maybe want to use this won't be very happy if they read such install notes...

Has any one got a little nice idea for me?
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 01:58 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs