|
#1
|
|||
|
|||
|
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&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);
?>
|
|
#2
|
||||
|
||||
|
are you saying you want to have the form in your admin panel rather than on the front page?
__________________
Affordable Website Design in North Wales |
|
#3
|
|||
|
|||
|
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? |
|
#4
|
||||
|
||||
|
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.
__________________
Affordable Website Design in North Wales |
|
#5
|
|||
|
|||
|
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 /> <RADOMLINK_CMMTPAGE>";
$addon_version = "1.0";
if( isset( $_GET['view'] ) && $_GET['view']=='addons' ){
echo"<form action=\"index.php?view=addons&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);
?>
|
|
#6
|
|||
|
|||
|
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? |
| Post Reply |
| Thread Tools | |
|
|