Made a code as a request for someone at Smfhacks.com
I felt like it was a good idea so I did it for them...I might as well share it here as well.. :P
global $scripturl, $modSettings, $db_prefix, $txt, $context, $settings, $boarddir;
// gallery.index.php is not loaded yet, so load it here
require_once($boarddir.'/Themes/default/languages/Gallery.english.php');
// text area tag var
$ta_tag = "TEXTAREA";
//Get the category
@$cat = (int) $_REQUEST['cat'];
// display the block info
echo '
<div class="tborder">
<form method="POST" enctype="multipart/form-data" name="picform" id="picform" action="' . $scripturl . '?action=gallery&sa=add2">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr class="catbg">
<td class="smalltext" width="50%" colspan="1" height="19" align="left"><b>Quick Gallery Upload</b></td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><b>Title:</b><br /><input type="text" name="title" size="15" /></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Category</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><select name="cat">';
// get our query results to create select box
$dbresult = db_query("SELECT ID_CAT, title FROM {$db_prefix}gallery_cat ORDER BY roworder ASC", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($dbresult)){
echo '
<option value="' . $row['ID_CAT'] . '" ' . (($cat == $row['ID_CAT']) ? ' selected="selected"' : '') .'>' . $row['title'] . '</option>';
}
echo '
</select>
</td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Description:</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><'.$ta_tag.' name="description" rows="6" cols="16"></'.$ta_tag.'></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Keywords:</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="text" name="keywords" maxlength="100" size="15" /></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>' . $txt['gallery_form_uploadpic'] . '</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="file" size="12" name="picture" /></td>
</tr>';
if(!empty($modSettings['gallery_commentchoice'])){
echo '
<tr class="windowbg2">
<td class="smalltext" align="left"><b>' . $txt['gallery_form_additionaloptions'] . '</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="checkbox" name="allowcomments" checked="checked" /><b>Allow Comments</b></td>
</tr>';
}
echo '
<tr class="windowbg2">
<td class="smalltext" width="28%" colspan="2" height="26" align="left" class="windowbg2"><input type="submit" value="Add Picture" name="submit" /></td>
</tr>';
if(!allowedTo('smfgallery_autoapprove')){
echo '
<tr class="windowbg2">
<td class="smalltext">'.$txt['gallery_form_notapproved'].'</td>
</tr>';
}
echo '
</table></form></div>
';
Put this is a Php box.
Updated Thanks to Thurnok :P
is this going in an PHP box, because when i do then after enable the box and then edit the box again the coding is runnen past the coding box is the box settings. Its to wide. Whel its a supper idear.
"is this going in an PHP box, because when i do then after enable the box and then edit the box again the coding is runnen past the coding box"
this happen on me too...but everytime i want to edit, i have to delete the phpbox first....then add a new one....is it the TP bugs or?
I said it doesn't work well with Internet explorer. :P
And yeah I think it might be a Tp error.
This is not a TP bug.
This is simply a peculiarity that one must be aware of when operating from within EVAL() functions which TP uses for blocks. Since the editor for blocks is a TEXTAREA you cannot embed a </textarea> tag in your block directly since it will close the editor textarea tag.
Instead, you need to break it up or call it as a variable so that it is parsed after the EVAL().
See the modified code in JPGs first post.
Ah I see, it edits onto the code that Tp uses for blocks...I see. :P
This one is nice, but when I looked at it in edit the code did not stay in the box in any theme. It went in right then when I look at it asfter saving it it is out... Happened 3 times--and currently?
What have you done there ?
You seem to have errors in the templatefiles aswell.
Reupload the TP files to your forum again, Use the Manual install package and just replace the files with the old you have.
Lol, blame Thurnok...*points to Thurnok* :D
I guess it's a one time edit deal for now...
[Same thing happens to me G6..it's the php block's code..not Tp itself...]
I was wondering why I don't see any errors ... I meant to ask if you had that prob JPG. :coolsmiley:
I Think I have become pre-programmed to think I did something to screw it up :o My first thought is usually "what did the Q do now" :uglystupid2:
OMG! LOL!!!
That's what I get for editing php code in the message editor! LOL.. ok, I fixed it and replaced it in JPGs first post. ... hehe... wooopsie! :)
Quote from: Thurnok on March 21, 2007, 02:01:34 AM
OMG! LOL!!!
That's what I get for editing php code in the message editor! LOL.. ok, I fixed it and replaced it in JPGs first post. ... hehe... wooopsie! :)
Thanks man. :D
I appreciate it.
hmmm-- don't seem to want to fit right in any theme
www.therockpile.org
on the left
check that :uglystupid2: it just don't look right in default and the one's I want to use ???
my left block not the default size, but smaller than the default. how can i resize this code to make same size with my left side block?
Yea I see that too---do me a favor and check your forum error log and see if it has any since you installed this. I am seeing 2. Maybe permission thing???
8: Undefined index: gallery_form_notapproved
File: /home2/^^^^^/public_html/Themes/default/Search.template.php (eval?)
Line: 73
and:
8: Undefined index: gallery_form_uploadpic
File: /home2/8888888/public_html/Themes/default/TPortal.template.php (eval?)
Line: 49
I went thru and cleaned it up alot for JPG. Was missing several </td>'s and other things. Changed the table size to 95%, and included the Gallery.english.php file which contains the text strings for the gallery since they are not loaded yet at the TP Block parsing.
Don't forget, if you have really long categories, the block will spill over into your centerblocks/articles because the select component will size to the largest category name size.
Quote from: Thurnok on March 22, 2007, 03:09:35 AM
I went thru and cleaned it up alot for JPG. Was missing several </td>'s and other things. Changed the table size to 95%, and included the Gallery.english.php file which contains the text strings for the gallery since they are not loaded yet at the TP Block parsing.
Don't forget, if you have really long categories, the block will spill over into your centerblocks/articles because the select component will size to the largest category name size.
Dude...I would kiss you if you weren't a dude. :D
Thanks Thurnok---error free :up: :up: :up:
oops.. heh.. I left out a class statement for one column.... anyway, it should look fairly good now... fixed..
QuoteDude...I would kiss you if you weren't a dude.
I can kiss him for you :-* :-* :-*
Quote from: G6â„¢ on March 22, 2007, 06:35:50 AM
I can kiss him for you :-* :-* :-*
Woohoo! I'll hold you to that at the TP Convention! :-*
Youd better have lifeguard with you :coolsmiley:
I think you will be the lifeguard. Of course, I'll be the drowning victim and need mouth-to-mouth resuscitation. ;)
;D
I put a small fix in the code in the first post of this topic. Should make it look right in various themes.
Don't forget however, that the form elements (input boxes, etc.) are all static, so depending on the theme and your block size, you might need to downsize some of the elements.
Hi :-)
Thanks for this Mod.
It's possibile convert the query ( get id_cat) for works with SMF2RC1 ?
Thanks
Antonio
You'll need to wait for a while fotografo74, TinyPortal has not yet been released or updated to work with SMF 2.0 and so there are no blocks for it at this time.
Excellent code...
Is it possible to exclude certain categories from showing up in the dropdown list?
Quote from: Ken. on February 24, 2009, 12:44:50 PM
You'll need to wait for a while fotografo74, TinyPortal has not yet been released or updated to work with SMF 2.0 and so there are no blocks for it at this time.
Ok, i'm waiting :-) ( and i'm waiting for TP2! )
I use SMF Gallery Random Images by Thurnok with SMF2...and works! :-)
forum test: www.macroforum.org/smf2rc/index.php
I need your block for works with SMF2 :-)
Thanks!
Antonio
Quote from: fotografo74 on February 24, 2009, 01:20:28 PM
Quote from: Ken. on February 24, 2009, 12:44:50 PM
You'll need to wait for a while fotografo74, TinyPortal has not yet been released or updated to work with SMF 2.0 and so there are no blocks for it at this time.
Ok, i'm waiting :-) ( and i'm waiting for TP2! )
I use SMF Gallery Random Images by Thurnok with SMF2...and works! :-)
forum test: www.macroforum.org/smf2rc/index.php
I need your block for works with SMF2 :-)
Thanks!
Antonio
Your test forum is running SimplePortal 2.1.1, so you should be asking them for a block code... we only do block codes for TinyPortal. :)
Quote from: Ken. on February 24, 2009, 01:58:57 PM
Quote from: fotografo74 on February 24, 2009, 01:20:28 PM
Quote from: Ken. on February 24, 2009, 12:44:50 PM
You'll need to wait for a while fotografo74, TinyPortal has not yet been released or updated to work with SMF 2.0 and so there are no blocks for it at this time.
Ok, i'm waiting :-) ( and i'm waiting for TP2! )
I use SMF Gallery Random Images by Thurnok with SMF2...and works! :-)
forum test: www.macroforum.org/smf2rc/index.php
I need your block for works with SMF2 :-)
Thanks!
Antonio
Your test forum is running SimplePortal 2.1.1, so you should be asking them for a block code... we only do block codes for TinyPortal. :)
Sure,but i will install TP2 in future...i'm waiting! in www.macroforum.org,official forum,i have TP.
The php block,and code,works to TP and SimplyPortal.
i will try modify myself the query for get id category. Without the query the block shows ok,but is not the category list.
Thanks!
antonio
I solved :-)
Now the code works with SMF2 RC1 ( i'm waiting TP2, now i use Simple Portal)
global $smcFunc, $scripturl, $txt, $context, $settings, $modSettings, $boarddir;
// gallery.index.php is not loaded yet, so load it here
require_once($boarddir.'/Themes/default/languages/Gallery.italian.php');
// text area tag var
$ta_tag = "TEXTAREA";
//Get the category
@$cat = (int) $_REQUEST['cat'];
// display the block info
echo '
<div class="tborder">
<form method="POST" enctype="multipart/form-data" name="picform" id="picform" action="' . $scripturl . '?action=gallery&sa=add2">
<table border="0" cellpadding="0" cellspacing="0" width="95%" align="center" height="129">
</tr>
<tr class="windowbg2">
<td class="smalltext"><b>Titolo:</b><br /><input type="text" name="title" size="15" /></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Categoria</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><select name="cat">';
// get our query results to create select box
$dbresult = $smcFunc['db_query'] ('', "
SELECT
id_cat, title, orderby
FROM {db_prefix}gallery_cat
ORDER BY roworder DESC");
while($row = $smcFunc ['db_fetch_assoc'] ($dbresult))
if (($row['id_cat'] != 1) && ($row['id_cat'] != 15) && ($row['id_cat'] != 16))
{ echo ' <option value="' . $row['id_cat'] . '" ' . (($cat == $row['id_cat']) ? ' selected="selected"' : '') .'>' . $row['title'] . '</option>'; }
echo '
</select>
</td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Descrizione:</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><'.$ta_tag.' name="description" rows="6" cols="16"></'.$ta_tag.'></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Parole chiave:</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="text" name="keywords" maxlength="100" size="15" /></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>' . $txt['gallery_form_uploadpic'] . '</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="file" size="12" name="picture" /></td>
</tr>';
if(!empty($modSettings['gallery_commentchoice'])){
echo '
<tr class="windowbg2">
<td class="smalltext" align="left"><b>' . $txt['gallery_form_additionaloptions'] . '</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="checkbox" name="allowcomments" checked="checked" /><b>Permetti commenti</b></td>
</tr>';
}
echo '
<tr class="windowbg2">
<td class="smalltext" width="28%" colspan="2" height="26" align="left" class="windowbg2"><input type="submit" value="Carica foto" name="submit" /></td>
</tr>
</table><br />
';
echo '
</form>
</div>';
I se that category number 1-15-16 in my Smf Gaeery Pro not display.
Antonio