4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Fugaziman on May 14, 2003, 08:52:02 PM
-
V.2. Thanks to V@no (were have I heard that before :?: :lol: ) and his performance tuning and 4images knowledge I have updated the part of this mod that changes the page_header.php file.
If you have already installed this mod don't worry just change the bit you added in the page_header.php file with the new code.
I'm afraid I can take no credit of this re-write at all. All must go to V@no.
I think for now on we should all come up with the ideas and V@no writes them up for us :lol:
This Mod creates a table that displays the number of new images in each category (that has new images)
and provides links to the search page that will only display new images for that specific category.
It will only show categories that the user has access to.
To see this in action just look at the left side column of my site under the Random Image
http://www.newman.d2g.com/
Time to add Mod:
15-20 minutes
Files Changed
- includes/page_header.php
- Search.php
- templates/your_template/home.html
Note: As usual - BACKUP all of these files before changing them.
:arrow: Edit includes/page_header.php
At the end of the page before:
?>
Add:
//-----------------------------------------------------
//---Show New Image count in category------------------
//-----------------------------------------------------
$new_image_category = "<table border=1 cellpadding=3 cellspacing=1 width=\"100%\">";
foreach ($new_image_cache as $key => $val) {
if ($val && check_permission("auth_viewcat", $key)) {
$category_link = "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_new_images=1&cat_id=".$key."&sub_cat=no")."\">".$val."</a>";
$new_image_category .= "<tr><td><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cat_cache[$key]['cat_id'])."\">".$cat_cache[$key]['cat_name']."</a></td><td><b>".$category_link."</b></td></tr>";
}
}
$new_image_category .= "</table>";
$site_template->register_vars("new_image_cats", $new_image_category);
unset($new_image_category);
:arrow: Edit Search.php
Find:
if (isset($HTTP_POST_VARS['search_fields'])) {
$search_fields = trim($HTTP_POST_VARS['search_fields']);
}
else {
$search_fields = "all";
}
Add After:
//-----------------------------------------------------
//---Show New Image count in category Mod -------------
//-----------------------------------------------------
if (isset($HTTP_GET_VARS['sub_cat'])) {
$sub_cat = trim($HTTP_GET_VARS['sub_cat']);
}
else
{
$sub_cat = isset($HTTP_POST_VARS['sub_cat']) ? trim($HTTP_POST_VARS['sub_cat']) : 1;
}
if (isset($HTTP_GET_VARS['cat_id'])) {
$search_cat = intval($HTTP_GET_VARS['cat_id']);
}
else {
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
}
//-----------------------------------------------------
//---End of Show New Image count in category Mod ------
//-----------------------------------------------------
Be careful with this bit, make shure you have all the }'s in place
Find:
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$cat_id_sql .= ", ".$search_id['search_cat'];
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
}
Replace with:
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$cat_id_sql .= ", ".$search_id['search_cat'];
if ($sub_cat != "no") { // Show New Image count in category Mod
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
} // Show New Image count in category Mod
}
:arrow: In your home.html file
Add:
{new_image_cats}
where you want the "New images in Category" to appear.
That's all there is to it.
Have fun
Fugaziman 8)
-
I saw this at your site yesterday...it's very nice!
and today u saved me from asking u to share with us that mod...hehe
good job ;)
-
Great idea, but if I open index.php, {new_image_cats} is there instead of the new image cats.
Any idea?
Thanks and cheers,
Markus
-
Great idea, but if I open index.php, {new_image_cats} is there instead of the new image cats.
Any idea?
Thanks and cheers,
Markus
Not quite sure what you mean :roll:
The {new_image_cats} should be added to your template files where you want it to display.
Can you give me a little more info :?:
Fugaziman
-
Now, everything works fine.
Thanks Fugaziman for his very good support.
Cheers,
Markus
-
Hi,
I checked out your mod on your page and it is great! So I tried to install it. However, I get this error message:
Fatal error: Call to undefined function: get_permission() in /abc/xyz/homepage/ewb/gallery/includes/page_header.php on line 321
Line 321 is the following:
$user_access = get_permission();
When I comment out this line, the error message disappears. And the mod still works! Any idea why? Where is this function defined? Do you need $user_access anywhere? I don't see where it is used. Or can you do without this line 321???
If I am not mistaken, get_permission is not php function, right? (I searcehd www.php.net on that.)
Any help is appreciated!
Moritz
-
great job i think i was the first beta tester... :lol: :lol:
BTW. V@no whats wrong with your icq?
-
Fatal error: Call to undefined function: get_permission() in /abc/xyz/homepage/ewb/gallery/includes/page_header.php on line 321
Line 321 is the following:
$user_access = get_permission();
When I comment out this line, the error message disappears. And the mod still works! Any idea why? Where is this function defined? Do you need $user_access anywhere? I don't see where it is used. Or can you do without this line 321???
If I am not mistaken, get_permission is not php function, right?
no, u dont need that line at all.
in each main file, before page_header.php being include, $user_access = get_permission(); already executes, so, it's just doublicate line, wasting server's recources ;)
BTW. V@no whats wrong with your icq?
I dont know, I'm online...but it seems none can see me and I cant receive messages? gotta try reinstall it, or... finaly reinstall the system...
@Fugaziman:
PM ;)
-
Hy ,
i istalld this Mod now i get this errormassage wen i klick on a category in the new fields:
Parse error: parse error in /homepages/3/d75848838/htdocs/main/foto-place/search.php on line 396
It´s the closingtag af search.php ?>
What can i do to fix it ??
lg
Gabi
-
Be careful with this bit, make shure you have all the }'s in place
;)
-
Be careful with this bit, make shure you have all the }'s in place
;)
yepp i saw that :D but its all there....this is the part wher i includet code:
if (!empty($search_id['search_cat']) && $search_id['search_cat'] != 0) {
$cat_id_sql = 0;
$sub_cat_ids = get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$cat_id_sql .= ", ".$search_id['search_cat'];
if ($sub_cat != "no") { // Show New Image count in category Mod
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
} // Show New Image count in category Mod
}
-
yepp i saw that :D but its all there....this is the part wher i includet code:
without putting your sample in my php editor I can see that u are missing one closing }
just add it near any of others closing }
-
good hack very thk
-
:D :D :D many thx to the author!!!
-
Fugaziman -
great mod !! - now for the question !!
any chance you can create an alternate mod so that rather than showing only the new images in a category - it display an (random) image from each category on the home page rather than just the random images that normally appear -
my goal is to present the home page with a quick foto of each of the events i cover and give the client the chance to do an at-a-glance of each new event (here is a site that does this ==> www.wireimage.com) and if the image rotates randomly within the event displayed ... that is good too ..
anyway .. all help is appreciated by all
thanx
bruce
-
Nice mod. I did have one problem, though. I have new images in a sub-subcategory (i.e. Zoo Events/Migratory Bird Day/Artwork). It gives me the correct number of new images in each sub-subcategory, but when I click on the link, it shows me all new images in the subcategory (i.e. Migratory Bird Day instead of Artwork or Games or Birds).
-
You need to make sure you correctly edited the Search.php
I had this problem myself when creating this mod so I know that this is were your problem is.
Hope that helps
Fugaziman
-
I have this mod installed, everything showed up fine!! But I have a problem when clicking on the new images. It doesn't take me directly to the cat_id, but instead it takes me to every new images that I have on my site.
I've try redoing the steps 4 or 5 times now...still can't figure out!!
My site is here, its on the right located under user login panel
http://www.idols-unlimited.com
Any help would be appreciated!
-
it should open the category page if u click on it's name, and search page if u click on the number ;)
-
I know, it doesn't do that even when i clicked on the number.
When I clicked on the number, it showed me every new pictures that i've added. I know its not suppose to work like that. I tested on the link provided on the first post, and it only shows the new images added to that specific catogory.
-
I know, it doesn't do that even when i clicked on the number.
When I clicked on the number, it showed me every new pictures that i've added. I know its not suppose to work like that. I tested on the link provided on the first post, and it only shows the new images added to that specific catogory.
yes me too click on a number all new images appear from all catagorys ..
-
the only explanation to that is u didnt do properly the search.php modifications.
-
Yup, you were right Veno!!
It turned out that I have one extra line of code floating around with no purpose. Deteled that line, and it works like a charm..thx for all the help guys!!
-
still nice mode :)
but i changed the layout of my page know i would like to have this {new_image_cats} in 3 Rows - which code part do i have to change?
sincerly
vincent
-
up
maybe somebody will read it!
vincent
-
Does this work fine in 1.71?
-
Interesting MOD. However,
this line :
$new_image_category = "<table border=1 cellpadding=3 cellspacing=1 width=\"100%\">";
could be replaced with
this one :
$new_image_category = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
and this part of the code :
$new_image_category .= "<tr><td>
could be replaced
with this one :
$new_image_category .= "<tr class=\"head1\"><td>
to maintain the user's presentation and to keep the user's table configuration settings from his ACP - > Settings page. ;)
-
I cannot get this to work because my template's left side is located in my templates header.html because it was a PHPBB template converted to 4images. I have tried everything I can think of to get it to show on the left side in my header.html but nothing works. I can get it to show in home.html but only in the center areas (where categories, whos online, etc. are).
Is there a change I need to make somewhere in this mod so that it will work for me when I add {new_image_cats} to my header.html?
-
just move the code in page_header.php above
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
-
Thanks for the reply V@no! Just to clarify so I understand: Move that to my header.html? And then I would add the {new_image_cats} in header.html?
Thanks!
just move the code in page_header.php above //-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
-
Just to clarify so I understand: Move that to my header.html?
no, move the code you added in includes/page_header.php above //-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
and not in header.html template!
Then you should be able use {new_image_cats} tag in header.html template.
P.S. sorry for editing your post, I pressed a wrong button, thought I was writing a reply, when its turned out I edited yours...
-
Thank you so very much V@no!!!! You truly are a life saver! :D At least a saver of my sanity! LOL
But I also have the same problems that everyone else posted about having trouble with the search results. If I click on the Category name, that category does show. But if I click on the number it brings up all new pictures. I double checked and even triple checked with the help of my husband and still nothing. I'll post my 2 bits of code that was told to be changed in the search.php with a few lines before and after to see if there was something like "whitespace" or something going on.
if (isset($HTTP_POST_VARS['search_fields'])) {
$search_fields = trim($HTTP_POST_VARS['search_fields']);
}
else {
$search_fields = "all";
}
//-----------------------------------------------------
//---Show New Image count in category Mod -------------
//-----------------------------------------------------
if (isset($HTTP_GET_VARS['sub_cat'])) {
$sub_cat = trim($HTTP_GET_VARS['sub_cat']);
}
if (isset($HTTP_GET_VARS['cat_id'])) {
$search_cat = intval($HTTP_GET_VARS['cat_id']);
}
else {
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
}
//----------------------------------------------------------------------------
//---End of Show New Image count in category Mod -----
//----------------------------------------------------------------------------
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
if (!empty($search_id['search_cat']) && $search_id['search_cat'] != 0) {
$cat_id_sql = 0;
$sub_cat_ids = get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$cat_id_sql .= ", ".$search_id['search_cat'];
if ($sub_cat != "no") { // Show New Image count in category Mod
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
} // Show New Image count in category Mod
}
}
else {
$cat_id_sql = get_auth_cat_sql("auth_viewcat");
}
Also, (sorry :oops:), how to I go about adding the Title (New Images Added, etc.) to the top like it is for Random Images (screen shot attached). And how do I make it so that the number of the new images stays where they are, but move back the category names so they are more to the left?
Thank you so much!!
-
I was able to fix the search issue:) I'll share what I found specifically for those that may have trouble like I did. As "Legendary" mentioned, there was an extra line of code floating around. This is what you need to delete AFTER End of Show New Image count in category Mod.
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
I hope this helps others:)
But I still need help on adding the Title (New Images Added, etc.) to the top like it is for Random Images and how to make it so that the number of the new images stays where they are, but move back the category names so they are more to the left. Anyone?
-
Nevermind:) I was able to figure out everything on my own :D
-
what if I want the numbers of then new images to lead to only the user's new images not all new images ?
is it posible to do so ? how ?
-
User's new images? what does it have to do with this mod?
-
I meant for that category not for all category .. that's when I click the number
-
If you installed this mod properly, that's how it would be.
-
If you installed this mod properly, that's how it would be.
yes .. I take this solution :
I was able to fix the search issue:) I'll share what I found specifically for those that may have trouble like I did. As "Legendary" mentioned, there was an extra line of code floating around. This is what you need to delete AFTER End of Show New Image count in category Mod.
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
I hope this helps others:)
But I still need help on adding the Title (New Images Added, etc.) to the top like it is for Random Images and how to make it so that the number of the new images stays where they are, but move back the category names so they are more to the left. Anyone?
thanks for both .. it's working now
-
SORTED 8)
[moved the script up on page_header seamed to work for me.]
just got to get the title heading to sorted now :roll:
-
Sorry ich antworte wieder in deutsch... (o:
Der zeigt dir nur die letzte xx Bilder an und diese halt nach upload datum sortiert und ein umsotieren ist hier nicht vorgesehen... (o:
-
wie schon gesagt, das aktuellste Bild wird oben angezeigt, mehr gesagt die Kategorie in welches es hochgeladen wurde.
wirst du jetzt ein bild in eine andere kategorie uploaden wird diese ganz oben stehen und das lässt sich mit diesen Mod nicht ändern... )o:
-
öffne global.php und suche:
$sql = "SELECT cat_id, COUNT(image_id) AS new_images
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_date >= $new_cutoff
GROUP BY cat_id";
$result = $site_db->query($sql);
Und dort wird man die sortierung vornehmen müssen... Ist aber nur eine Vermutung und ich weiss nicht welche Auswirkungen es auf die restlichen Funktionen hat...
Frage Vincent doch am besten mal...
-
@bildergallery
wie ich sehe ist deine Liste auf der linken seite auch sortiert alphabetisch.
gruss
vincent
-
@Vincent
Zähle mir mal bitte das alphabet auf...
A, N, S, C... *g*
Es ging nicht um die Kategorien sondern um die "letzte 45 tage" box.. (o:
Oder bin ich jetzt schon völlig durch und peile nichts mehr...
-
@acidgod
ok unterdessen hab auch ich verstanden worum es geht :oops:
gruss
vincent
-
foreach ($new_image_cache as $key => $val) {
if ($val && check_permission("auth_viewcat", $key)) {
$category_link = "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_new_images=1&cat_id=".$key."&sub_cat=no")."\">".$val."</a>";
$new_image_category .= "<tr><td><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cat_cache[$key]['cat_id'])."\">".$cat_cache[$key]['cat_name']."</a></td><td><b>".$category_link."</b></td></tr>";
}
}
Dort in der page_header.php an dieser stelle (<td><b>".$category_link."</b></td>) dein align im TD Tag definieren...
-
hallo!
ich hätte da auch einen wunsch:
ich möchte gerne ein kategorie-image angezeigt bekommen. hat jemand eine idee für mich?
-
Is it possible to modify this to display the new category and its immediate parent category in the display box? E.g. Family Photos > Dad. If so, can anyone recommend how?
-
Hallo!
Ich habe das selbe Problem wie Ivan. Ich finde es zwar nicht allzu schlimm, ist aber einen Fehler.
Nun grundsätzlich funktioniert der Mod aber wenn ich die Zahl "Anzahl Bilder" Anklicke
wechselt es in den Suchmodus, anschliessen klicke ich auf 30 Bilder Anzeigen und
da wird lustiger weise "Die Suche ergab leider keine Treffer." angezeigt.
Wie können die Kategorien anderst als cat_id sortiert werden?
Ich möchte gerne die Kategorie zu oberst haben mit den allerneusten Bilder (Sortierung wie bei den Bilder: image_date DESC).
Ist dies überhaupt möglich?
Vielen Dank im Voraus.
Grüsse Jones
-
Hallo,
kann das was für Dich sein :arrow: http://www.4homepages.de/forum/index.php?topic=4312.0
nobby
-
Hallo
Danke für deine prompte Antwort.
Ich glaube eher weniger, da ich nicht alle Kategorien anderst ordnen möchte, sondern nur bei dieser Anzeige der Kategorien von diesem MOD.
Demfall eher unwahrscheindlich, dass es gehen würde.
Gruss
-
Ja, hier war mal was mit Sortierung von Kategorien.
Schade das es Dir nicht Hilft.
-
Thanks for this nice mod. been looking for it.
one question, how do i get the recently updated category to the top. right now it shows in the bottom of the list.
-
Do somebody know if it is hard to set up this Mod for only 1 or 2 categories and their subcategories - not for all for them ? I want only to show the info from one - two categories and their subcats . Like this I have 40cm long list in sidebar with many not very interesting cats , or if their is some possibility to reduce - days , number of cats etc . I didnt find anything for reduce - for example only for last 5 days . Thanks Daniel , otherwise easy to install and I think that also useful .
-
Hi -
Using v1.7.7
Got this MOD installed and working great except for one issue: an error message on the second and additional search pages:
Notice: Undefined variable: sub_cat in /home1/glxxxx/public_html/ouragallery/search.php on line 220
Here is line 220 from search.php file:
if ($sub_cat != "no") { // Show New Image count in category Mod
which is directly from this MOD
How do I see this error?
I click on the number of new images in a given particular category. In this case, it was 48 images. The result is the search page that presents 48 images, and I have it set to show 18 images per page. First page is fine. However, if I click on page 2 or page 3, the above error displays above the header.
Here is the url that is associated with page 3:
http://www.gxxx.info/ouragallery/search.php?show_result=1&page=3
Anyone else experience this? Got any ideas how to fix this?
Thanks,
Brian
-
The code on first page is fixed now.
In search.php find:
if (isset($HTTP_GET_VARS['sub_cat'])) {
$sub_cat = trim($HTTP_GET_VARS['sub_cat']);
}
Insert below:
else
{
$sub_cat = isset($HTTP_POST_VARS['sub_cat']) ? trim($HTTP_POST_VARS['sub_cat']) : 1;
}
-
Hi -
Thanks for the quick solution. Made the code changes and badda bing, everything is working perfectly.
Brian