|
#21
|
|||
|
|||
|
are you 100% sure its not working. I took your index.php and put it on my server and ran it.....it worked without any errors.
all boxes displayed... If you still get the error, what happens to cause it...do you just load it or are you clicking something first? |
|
#22
|
|||
|
|||
|
100 % sure. I just load admin/index.
|
|
#23
|
|||
|
|||
|
Hmm...well can you go ahead and first try to load up your old index.php and remake all the changes from scratch?
i load up your admin/index.php file perfectly...no errors... Are you sure you sent me the broken version? |
|
#24
|
|||
|
|||
|
I have made a new/fresh installation of Pixelpost, i have reinstalled de multicategory hack and become de same error at line 316.
|
|
#25
|
|||
|
|||
|
hmm...this is strange...I guess its possibe it has something to do with your PHP version on your server, but that would be odd considering all the rest works...
I'd say, lets try this: Take out the piece that was giving the error.....(the piece that is shown in this forum thread...the part that i forgot) and then run it....You mentioned before you were getting checkboxes on update page, but not new image page, right? Ok, once you have it working without the error, try JUST changing these lines.. Code:
File Under Category<br />
<select name="category">
<?php
$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name");
while(list($id,$name) = mysql_fetch_row($query)) {
$name = pullout($name);
echo "<option value='$id'>$name</option>\n";
}
?>
</select><p />
Code:
File Under Category<br /><br />
<?php
$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name");
while(list($id,$name) = mysql_fetch_row($query)) {
$name = pullout($name);
echo "<input type=checkbox name=box[] value=".$id.">&nbsp;".$name."<br />";
}
?>
<br /><br />
|
|
#26
|
|||
|
|||
|
I'm Sorry:
Parse error: parse error, unexpected T_STRING in /home/reculltk/public_html/iblitz/admin/index.php on line 326 PHP Version 4.3.10 I feel to bother. If you want I leave it. |
|
#27
|
|||
|
|||
|
what is at line 326 ? The version of index.php you sent me the other day is not numbered the same as the one you have now..
|
|
#28
|
|||
|
|||
|
Mark,
Thanks for writing this. I've been wanting to do it for a while now, but was too lazy. You made my life much easier. I did put in a few further tweaks along with your code. I removed all references to the old category_id in the main image table and deleted that column (this required a change to the browse page code). I also did not include an ID in the new table. I only have the category and image IDs acting as a composite primary key. Good work! Andy |
|
#29
|
|||
|
|||
|
hi!
i really like this addon, and am using it on my fotoblog. but there's something wrong with it. some posted images are multiply categorized, and others aren't. here is my 'how-to-use MutipleCategoriesAddon'. does it seem to be right? 1) after performing "install_assoc.php", rewrite "index.php" as following; replace Code:
if($_GET['x'] == "browse") {
$thumb_output = "";
$where = "";
if($_GET['category'] != "") { $where = "and (category='".$_GET['category']."')"; }
$query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') $where order by datetime desc");
while(list($id,$title,$name) = mysql_fetch_row($query)) {
$title = pullout($title);
$thumbnail = "thumbnails/thumb_$name";
$thumb_output .= "<a href='$PHP_SELF?showimage=$id'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a>";
}
$tpl = ereg_replace("<THUMBNAILS>",$thumb_output,$tpl);
}
// build browse menu
Code:
[color=red]if($_GET['x'] == "browse") {
$thumb_output = "";
$where = "";
if($_GET['category'] != "") {
$query = mysql_query("select t2.id,headline,image,datetime from ".$pixelpost_db_prefix."catassoc as t1 inner join ".$pixelpost_db_prefix."pixelpost t2 on t2.id = t1.image_id where t1.cat_id = '".$_GET['category']."' order by datetime desc");
} ELSE IF ($_GET['archivedate'] != "") {
$where = "and (DATE_FORMAT(datetime, '%Y-%m')='".$_GET['archivedate']."')"; //DATE_FORMAT(foo, '%Y-%m-%d')
$query = mysql_query("select id,headline,image, datetime from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') $where order by datetime desc");
} ELSE {
$query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') order by datetime desc");
}
while(list($id,$title,$name) = mysql_fetch_row($query)) {
$title = pullout($title);
$thumbnail = "thumbnails/thumb_$name";
$thumb_output .= "<a href='$PHP_SELF?showimage=$id'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a>";
}
$tpl = ereg_replace("<THUMBNAILS>",$thumb_output,$tpl);
}
// build browse menu[/color]
! There're six parts to be replaced #1 replace Code:
if($_GET['view'] == "") {
?>
<div id='jcaption'>
Post a New Image</div>
<div id="content">
<form method="post" action="<?php echo $PHP_SELF; ?>?x=save" enctype="multipart/form-data">
Image Title<br />
<input type="text" name="headline" style="width:95%;" /><p />
File Under Category<br />
<select name="category">
<?php
$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name");
while(list($id,$name) = mysql_fetch_row($query)) {
$name = pullout($name);
echo "<option value='$id'>$name</option>\n";
}
?>
</select><p />
Code:
[color=red]if($_GET['view'] == "") {
?>
<div id='jcaption'>
Post a New Image</div>
<div id="content">
<form method="post" action="<?php echo $PHP_SELF; ?>?x=save" enctype="multipart/form-data">
Image Title<br />
<input type="text" name="headline" style="width:95%;" /><p />
File Under Category<br /><br />
<?php
$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name");
while(list($id,$name) = mysql_fetch_row($query)) {
$name = pullout($name);
echo "<input type=checkbox name=box[] value=".$id."> ".$name."<br/>";
}
?>
<br /><br />[/color]
replace Code:
// insert post in mysql
$image = $filnamn;
if($status == "ok") {
$query = "insert into ".$pixelpost_db_prefix."pixelpost(id,datetime,headline,body,image, category)
VALUES('NULL','$datetime','$headline','$body','$image','$category')";
$result = mysql_query($query) || die("Error: ".mysql_error());
// done
Code:
[color=red]// insert post in mysql
$image = $filnamn;
if($status == "ok") {
$query = "insert into ".$pixelpost_db_prefix."pixelpost(id,datetime,headline,body,image, category)
VALUES('NULL','$datetime','$headline','$body','$image','$category')";
$result = mysql_query($query) || die("Error: ".mysql_error());
$theid = mysql_insert_id(); //Gets the id of the last added image to use in the next "insert"
foreach($_POST['box'] as $val) {
$query ="insert into ".$pixelpost_db_prefix."catassoc(id,cat_id,image_id) VALUES('NULL','$val','$theid')";
$result = mysql_query($query) || die("Error: ".mysql_error());
}
// done[/color]
replace Code:
// view=images
if($_GET['view'] == "images") {
// x=update
if($_GET['x'] == "update") {
$headline = clean($_POST['headline']);
$body = clean($_POST['body']);
$getid = $_GET['imageid'];
$newdatetime = $_POST['newdatetime'];
$category = clean($_POST['category']);
$query = "update ".$pixelpost_db_prefix."pixelpost set datetime='$newdatetime', headline='$headline', body='$body', category='$category' where id='$getid'";
$result = mysql_query($query) ||("Error: ".mysql_error());
echo "<div id='jcaption'>Image update</div>
<div id='content'>Updated image #$getid.</div><p />";
}
Code:
[color=red]if($_GET['view'] == "images") {
// x=update
if($_GET['x'] == "update") {
$headline = clean($_POST['headline']);
$body = clean($_POST['body']);
$getid = $_GET['imageid'];
$newdatetime = $_POST['newdatetime'];
// Since I really couldnt come up with a better way to do this without checking to see what boxes are still checked
// since it was created, I decided to just delete all rows in the database and then re-update them. It really does
// no harm to do it this way
$query = "delete from ".$pixelpost_db_prefix."catassoc where image_id='$getid'";
$result = mysql_query($query) ||("Error: ".mysql_error());
// Now Im adding them back
foreach($_POST['box'] as $val) {
$category = $val;
$query ="insert into ".$pixelpost_db_prefix."catassoc(id,cat_id,image_id) VALUES('NULL','$val','$getid')";
$result = mysql_query($query) || die("Error: ".mysql_error());
}
$query = "update ".$pixelpost_db_prefix."pixelpost set datetime='$newdatetime', headline='$headline', body='$body', category='$category' where id='$getid'";
$result = mysql_query($query) ||("Error: ".mysql_error());
echo "<div id='jcaption'>Image update</div>
<div id='content'>Updated image #$getid.</div><p />";
}[/color]
replace Code:
if($_GET['x'] == "delete") {
$getid = $_GET['imageid'];
$images = mysql_query("SELECT image FROM ".$pixelpost_db_prefix."pixelpost where id='$getid'");
$imagerow = mysql_fetch_array($images);
$image = $imagerow['image'];
$file_to_del = "$upload_dir".$imagerow['image'];
echo "<div id='jcaption'>Post removal / Image deletion / thumbnail deletion</div>
<div id='content'>";
$query = "delete from ".$pixelpost_db_prefix."pixelpost where id='$getid'";
$result = mysql_query($query) ||("Error: ".mysql_error());
echo "Post deleted.<p />";
if(unlink($file_to_del)) {
$image_message = "Image deleted.<p />";
} else { $image_message = "Could not delete imagefile. You have to do that some other way, with your ftp software perhaps.<p />"; }
echo $image_message;
$file_to_del = "../thumbnails/thumb_".$imagerow['image'];
if(unlink($file_to_del)) {
$image_message = "Thumbnail deleted.<p />";
} else { $image_message = "Could not delete thumbnail. You have to do that some other way, with your ftp software perhaps.<p />"; }
echo $image_message."</div>";
}
Code:
[color=red]if($_GET['x'] == "delete") {
$getid = $_GET['imageid'];
$images = mysql_query("SELECT image FROM ".$pixelpost_db_prefix."pixelpost where id='$getid'");
$imagerow = mysql_fetch_array($images);
$image = $imagerow['image'];
$file_to_del = "$upload_dir".$imagerow['image'];
echo "<div id='jcaption'>Post removal / Image deletion / thumbnail deletion</div>
<div id='content'>";
$query = "delete from ".$pixelpost_db_prefix."pixelpost where id='$getid'";
$result = mysql_query($query) ||("Error: ".mysql_error());
// Delete the associations for image to be deleted
$query = "delete from ".$pixelpost_db_prefix."catassoc where image_id='$getid'";
$result = mysql_query($query) ||("Error: ".mysql_error());
echo "Post deleted. Associated categories deleted<p />";
if(unlink($file_to_del)) {
$image_message = "Image deleted.<p />";
} else { $image_message = "Could not delete imagefile. You have to do that some other way, with your ftp software perhaps.<p />"; }
echo $image_message;
$file_to_del = "../thumbnails/thumb_".$imagerow['image'];
if(unlink($file_to_del)) {
$image_message = "Thumbnail deleted.<p />";
} else { $image_message = "Could not delete thumbnail. You have to do that some other way, with your ftp software perhaps.<p />"; }
echo $image_message."</div>";
}
[/color]
replace Code:
// print out a list over images/posts
if($_GET['id'] == "") {
echo "<div id='jcaption'>Images / Posts - Edit or Delete an image</div>
<div id='content'><ul>";
if($_GET['page'] == "") { $page = "0"; } else { $page = $_GET['page']; }
$pagec = 0;
$images = mysql_query("SELECT * FROM ".$pixelpost_db_prefix."pixelpost ORDER BY datetime DESC limit $page,10");
while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($images)) {
$headline = pullout($headline);
echo "<li>
<img src='../thumbnails/thumb_$image' />
<strong>$headline</strong><br />
<a href=\"$PHP_SELF?view=images&id=$id\">[edit]</a>
<a onclick=\"return confirmSubmit()\" href=\"$PHP_SELF?view=images&x=delete&imageid=$id\">[delete]</a></li>
";
$pagec++;
}
echo "</ul>
Code:
[color=red]// print out a list over images/posts
if($_GET['id'] == "") {
echo "<div id='jcaption'>Images / Posts - Edit or Delete an image</div>
<div id='content'><ul>";
if($_GET['page'] == "") { $page = "0"; } else { $page = $_GET['page']; }
$pagec = 0;
$images = mysql_query("SELECT * FROM ".$pixelpost_db_prefix."pixelpost ORDER BY datetime DESC limit $page,100");
while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($images)) {
$headline = pullout($headline);
echo "<li>
<img src='../thumbnails/thumb_$image' />
<strong>$headline</strong><br />
<a href=\"$PHP_SELF?view=images&id=$id\">[edit]</a>
<a onclick=\"return confirmSubmit()\" href=\"$PHP_SELF?view=images&x=delete&imageid=$id\">[delete]</a>
";
$category_list = mysql_query("SELECT t2.name FROM ".$pixelpost_db_prefix."catassoc t1 inner join ".$pixelpost_db_prefix."categories t2 on t1.cat_id = t2.id where t1.image_id = '$id'");
while(list($category_name) = mysql_fetch_row($category_list)) {
$category_name = pullout($category_name);
echo "[$category_name]";
}
echo "</li>";
$pagec++;
}
echo "</ul>
[/color]
replace Code:
<div id='jcaption'>
Edit Image
</div>
<div id='content'>
<form method='post' action='$PHP_SELF?view=images&x=update&imageid=$getid'>
Title<br />
<input type='text' name='headline' value='$headline' style='width:300px;' /><p />
Text / description<br />
<textarea name='body' style='width:95%;height:100px;'>$body</textarea><p />
Category<br />
<select name='category'>
";
$query = mysql_query("select name from ".$pixelpost_db_prefix."categories where id='$category'");
$query = mysql_fetch_array($query);
$nice_category = pullout($query['name']);
echo "
<option value='$category'>$nice_category</option>
<option value=''> - Set New Category - </option>
";
$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name");
while(list($id,$name) = mysql_fetch_row($query)) {
$name = pullout($name);
echo "<option value='$id'>$name</option>\n";
}
echo "
</select><p />
Code:
[color=red]<div id='jcaption'>
Edit Image
</div>
<div id='content'>
<form method='post' action='$PHP_SELF?view=images&x=update&imageid=$getid'>
Title<br />
<input type='text' name='headline' value='$headline' style='width:300px;' /><p />
Text / description<br />
<textarea name='body' style='width:95%;height:100px;'>$body</textarea><p />
Category<br />
";
$query = mysql_query("select t1.id, name, image_id from ".$pixelpost_db_prefix."categories as t1 left join ".$pixelpost_db_prefix."catassoc t2 on t2.cat_id = t1.id and t2.image_id='$getid'");
while(list($id,$name,$image_id) = mysql_fetch_row($query)) {
$name = pullout($name);
$id = pullout($id);
if ($image_id != "") {
echo "<input type=checkbox CHECKED name=box[] value=".$id."> ".$name."<br/>";
} else {echo "<input type=checkbox name=box[] value=".$id."> ".$name."<br/>";}
}
echo "
<p />[/color]
And this is the way i have done for this addon. it seems to work fine, but as I mentioned before, some posted images are multiplly categorized, and some aren't. Could someone give me a hint? io |
|
#30
|
|||
|
|||
|
without going through all the above stuff...im gonna assume its very similar to my doc??
as to the post that are not multi categorized, are you postive that they have been assigned more then one category? |
| Post Reply |
| Thread Tools | |
|
|