 | |  | | | Photopost Pro How Do I...? Wondering how to do things in PhotoPost? |
July 17th, 2009, 03:54 PM
|
#1 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
| vBulletin code and variable in photopost
Dear Support,
In a vBulletin template I use following code to display extra fields generated by vBulleting, now I want this information (about the users photography skills) to display on the showphoto template in PhotoPost.
I know where I want this to disply on the site and the location in the template, but the code does not work properly, should it be converted to work with PhotoPost? Can you please, please help me to convert this code to work with PhotoPost? Thank you in advance for you help.
G. Diepeveen
The code:
<!-- Start toevoeging niveau van de fotograaf -->
<br /><div class="niveau2">Fotografie niveau:<div class="niveau">
<if condition="$post[field7]==0">niet opgegeven</if>
<if condition="$post[field7]==1">Beginner</if>
<if condition="$post[field7]==2">Gevorderde</if>
<if condition="$post[field7]==4">Gevorderd Deskundige</if>
<if condition="$post[field7]==8">Professioneel</if>
<if condition="$post[field7]==16">Ervaren Deskundige</if>
</div></div>
<!-- End toevoeging niveau van de fotograaf -->
|
| |
July 17th, 2009, 05:27 PM
|
#2 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
Well post likely you will have to create some kind of modification and apply it.
I mean your going to have to query your vb database to define such a field as $post[field7] because most likely whereever else your doing this your modifying vb to grab that database in a specific area so you want to do something similar in photopost.
|
| |
July 18th, 2009, 11:33 AM
|
#3 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
Chuck, what I meant was that the code could work, but I see for example in the photopost templates another syntax for <if></if> that's my problem, hou to code this in a manner that PhotoPost can read.
I did try to translate it to this: (see below) but I get everytime this error: Parse error: syntax error, unexpected '}' in /home/wfcfoos8/public_html/templates/vb3enhanced/showphoto.tmpl on line 115
Somehow there is a } that sjould not be in the code, but which one?
<!-- Start toevoeging niveau van de fotograaf -->
PPPRINT;
if ($post[field7] == 0)
{
$niveaumelding="niet opgegeven"}
if ($post[field7] == 1)
{
$niveaumelding="Beginner"}
if (post[field7] == 2)
{
$niveaumelding="Gevorderde"}
if ($post[field7] == 4)
{
$niveaumelding="Gevorderd Deskundige"}
if ($post[field7] == 8)
{
$niveaumelding="Professioneel"}
if ($post[field7] == 16)
{
$niveaumelding="Ervaren Deskundige"}
if ($post[field7] == 32)
{
$niveaumelding="-"}
echo<<<PPPRINT
<br /><div class="niveau2">Fotografie niveau:<div class="niveau">$niveaumelding
<!-- End toevoeging niveau van de fotograaf -->
Last edited by drare; July 18th, 2009 at 12:14 PM.
|
| |
July 18th, 2009, 02:47 PM
|
#4 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
This should be in the showphoto.php script somewhere. But what I am saying is thats never going to work. How is photopost going to know what that $post field from some vb query is? You most likely have some plugin setup to work for a specific area and query action in vb its not going to carry over everywhere. Code: Content visible to verified customers only.
Then you can place whatever variable you wish in the template but php code should go in the php file
You need to query and define what post field 7 is so you need to make a query to get that info based on the user who posted the photos userid.
Do you follow.
|
| |
July 18th, 2009, 03:46 PM
|
#5 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
I wish I could follow you, but I think this thing with query's is going way over my head I'm affraid.
I've tried something else, but also this is not workng at least so far, I tried to use the ICQ field in the member profile to use the $icq variable in the showphoto template, it's not showing the $icq I guess is not a global variable, I've looked at he member.php, but I can't figure how to implement this into showphoto.php.
I thought no one is using the icq so I changed the input field to a selection box, that's working, but the variable $icq is not passed through the showphoto.php and tmpl files.
Hmmm tricky this one, I wish I had more knolegde of programming php and databases, anyway thank you so far Chuck, your most kind to help us.
|
| |
July 18th, 2009, 05:52 PM
|
#6 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
Not a problem.
|
| |
July 19th, 2009, 04:56 AM
|
#7 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
Chuck, just to make sure, I try to be a quick learner, I'm a selfmade man, most software I learn from working whit, I learned English from tv watching the BBC programs without subtitle, but that's oftopic, so again I come before you whit a question for a example query
Lets say I want to search for the icq number in a users profile, I was looking in the php code an made this query: $resulta = ppmysql_query("SELECT icq FROM {$Globals['pp_db_prefix']} users WHERE userid=$uid LIMIT 1", $link);
The part from "FROM....$link);" however I havn't figured out yet. But my guess was that this is what I need to do in order to find the icq number of members and display it on a template.
Pherhaps I'm asking to much of you, you are a busy man replying to all those that have questions, but still I was hoping if you can tell me if I'm on the right track towards the finish, finally I should win something and cross the finish line in order to receive my coding award |
| |
July 19th, 2009, 06:22 AM
|
#8 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
$link is a mysql link to photopost database. You can use $db_link to connect to the forum database this is if your tables are in different databases.
The query you dont want to query the photopost table you want to query the vb users table so you want a query like this Code: Content visible to verified customers only.
See this might get you close if you put some query like this and the code I posted above in the showphoto.php file but again I am only guessing at the location of any fields your trying to show.
|
| |
July 19th, 2009, 06:33 AM
|
#9 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
I understand your guess work, but it helps me alot to get this working for us, so can imagine I'm happy you are doing this, I'll come back if I got it working, Thanks Chuck.
The location of field7 is bb_userfield for vb3 in the same database as PP I found this by looking whit php admin in the database, I changed the code to: $queryv = ppmysql_query("SELECT field7 FROM {$Globals['bb_userfield']}usertextfield WHERE userid='$iuserid'",$link);
list( $post[field7] ) = mysql_fetch_row($queryv);
however I do get this error: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/wfcfoos8/public_html/showphoto.php on line 83 So this I need to figure out yet.
Wow I realize now I'm beginning to get experience as database programmer, so you have a job for me Chuck  Just Kidding!
Last edited by drare; July 19th, 2009 at 07:08 AM.
|
| |
July 19th, 2009, 10:16 AM
|
#10 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
Dear Chuck I've done it!!!
I have a query in showphoto.php, and it returns a number, just what I did expect it to do, that's why I have to convert the numeric to a string like this beneath, the only thing is, that the if statements do not work, I only see one, No 4 for every member, do I still miss something in the query, somehow not all values are past through the query? Code: Content visible to verified customers only.
Last edited by drare; July 19th, 2009 at 10:56 AM.
|
| |
July 19th, 2009, 02:53 PM
|
#11 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
That code looks fine to me. It should simply return the field for the user whom posted the photo if indeed your code is right but as I have repeatedly posted I am not exactly sure where your posting or what your doing. I am making guesses here at what your doing.
|
| |
July 19th, 2009, 03:11 PM
|
#12 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
Let me explain the intention of this, if you visit this page: Example forum page you see this line of text: "Gevorderd Deskundige" in yellow next to my avatar, that's the field7 in vBulletin that our members can choose, the same field7 should be placed on the showhoto page: Example of one of my photo's below the photo and under my avatar in this example.
The code is correct, it works, that's what you also say, and gets the field7 value, field7 is a dropdown selection with 6 choices the user can choose just one to show their photography level. Somehow it shows for every member in PP the same value, so somewhere in de code is something missing, I hope I have explained this correctly.
Your guesses have been right so far, and for 90% I have what I need.
I you need more, tell me.
Gerard
Last edited by drare; July 19th, 2009 at 03:32 PM.
|
| |
July 19th, 2009, 03:34 PM
|
#13 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
well have you tried this? Code: Content visible to verified customers only.
|
| |
July 19th, 2009, 04:00 PM
|
#14 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
I just did Chuck, but still it gives the output we need, in others words, the field7 is there in showphoto, but still for every member the same.
But I found out something, I changed this setting for my account, and see what happens, all members are changed with it to what I set the field7 to in my account, so my guess is the query is not complete, it somehow only filters just my setting and not the setting of other members, but what should complete the query, that's the question, should I add a rows statement into the query (if possible), I saw somthing like that.
But I will try further tomorrow, it's way past my bedtime ;-) If you still have suggestions, let me know.
My sincere regards for your great help in this matter Chuck, I could not have come so far without your knowlegde and great guess work, keep this up. Also now I know why I did choose this software package, the greatness of it, and the knowlegde of the engineers behind it.
Can I do something in return for you, just say it? Want a logo on our site that says: powered by Photopost? I will make it happen.
Gerard
Last edited by drare; July 19th, 2009 at 04:06 PM.
|
| |
July 19th, 2009, 07:27 PM
|
#15 (permalink)
| | Member Verified Customer
Join Date: Dec 2004 Location: Osaka
Posts: 158
|
Change your top query to : Code: Content visible to verified customers only.
(it must be AFTER line 83 of showphoto.php)
|
| |
July 20th, 2009, 02:02 AM
|
#16 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
benFF, I've tried this and didn't work, again I did add this line, BUT! I've placed it like you said after line 83! IT WORKS! Thanks benFF nou all member are displaying with there own level.
Boy have I learned something these past days, Chuck, benFF much obliged for you input in this matter.
Gerard
|
| |
July 20th, 2009, 04:59 AM
|
#17 (permalink)
| | Member Verified Customer
Join Date: Dec 2004 Location: Osaka
Posts: 158
|
Hi Gerard,
No problem - I also recommend you get rid of that massive if block and replace with: Code: Content visible to verified customers only.
(If there will always be a value, then I recommend putting the "case 0" code in the default section and removing the "case 0:" bit totally as it will always get picked up if the other conditions fail)
|
| |
July 20th, 2009, 05:32 AM
|
#18 (permalink)
| | Member Verified Customer
Join Date: Feb 2009 Location: Holland
Posts: 116
|
Ok, ben, thanks, this would be better, yes the case 0 is indeed the default a single "-" will be displayed if no choice has been made, I've put it in and works fine.
So now I have the skils level beatifull placed beneath the avatar of the users photo, now I would like it to push a little further, when another user has given a comment on the photo it will appear below the photo, now my members ask if it would be possible to place the same skills level also beneath the avatar of the user who has given the comment, see this example, on the first comment you see the text: "Fotografie niveau:" (photography level) under this should be again the skills level, but the comment code is also in showphoto.php, but with the code in this topic I does display the level, but it looks at the users level of the photo.
So I guess the line in the query: Code: Content visible to verified customers only.
should be different because this is not properly displaying the right skills level for a particular user, any guesses?
|
| |
July 20th, 2009, 10:29 AM
|
#19 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
You put your query up too high where $iuserid was not defined there you go.
|
| |
July 20th, 2009, 11:28 AM
|
#20 (permalink)
| | Member Verified Customer
Join Date: Dec 2004 Location: Osaka
Posts: 158
|
If every photo is going to have a "ranking" and all comments too, then you'd be better off modifying the current Photopost code itself and slinging in an outer join to get the data.
I'm not at my main machine now, so cant see the current code - but if you know what an OJ is, then it's not too hard to add in |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -5. The time now is 09:46 AM. | |