Adding a Comments Box to the Page Once again, this is a great piece to add to my site, and a great tutorial. I am using this basic page to display photographs, but I want to add a "Comments Box" to each generated page (like the default Blog and Articles pages have). How would I go about doing this? Can I just copy/paste the appropriate material from the blog.php or article.php, or do I have to use customization? Thanks again! Jack |
You would need to create a form in the template to do something with the comments and then you will need to write the php code to process any comment made. You will probably be able to copy alot of it from the blog/article page, but it will be different since you will be storing the data in a different table in the database.
|
Thank you.
|
Just a statement,.. I will be posting my code, I just am covered up at the moment at home.
|
Quote:
This is what I have so far.... 1 - I created a product xml that creates a database and supporting template very similar to the one posted by Lynne. The template has several if ($_REQUEST['do'] =='s installed for different page renderings depending on function desired. IE: home,list,add,edit,delete of database entries. So far, works perfectly. Now I am working on the list part of the database. I have entered several rows of test data into the database manually through phpmyadmin. As I ventured into using if ($_REQUEST['do'] == 'history') in the php file I know that I have to build an array to send to the template (sorted by date). Database structure: date field, data1, data2, data3, data4, data5, data6 I tried to build a loop to fill a variable array and it seemed that it was working, but I couldnt figure out how to list that array in the template. I am unsure if I have to register the variable, it is only used on this feature I am making. When I tried to output the array in the template, it would print out one row of data (correctly), not the whole database, and it would be on the very top of my page above the header. I am going to have to reconstruct it again to get to that point, I seemed to have trashed the experimental code in frustration of not getting it to work, and having to start the bedroom remodel. :( |
You can't use echo or it will end up on the top of the page. You need to take your data and output it to a variable:
$myvar = ''; start of loop $myvar .= "html here"; end of loop make sure to register $myvar for use in your template and in the template, put {vb:raw myvar} |
Thanks, will give that a try.
(I suppose you saw my error in stating that the multiple "do" functions were put in the template, I meant they were put in the php file, each one with a different template used.) --------------- Added [DATE]1381803115[/DATE] at [TIME]1381803115[/TIME] --------------- Ok, there is a reason I dont release mods here. Cous I seem to struggle with the obvious lol. I have registered the variable,... $templater->register('history', $history); I thought I would just start simple and just have 1 row in my database. From there I will expand on it once I can get a simple read done. This is my php query. (kinda found it while searching the forums and modified it to my purpose) Code:
$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history"); |
I would use fetch_array in case you to later have multiple rows and you should specify the field you want. Assuming you want history.field, then:
PHP Code:
HTML Code:
{vb:raw history.field} |
Quote:
Greetings I added the lines you included, the page looks much better, but still seems to be in a "not logged in" mode. I'm not much of a PHP coder so I don't really know what code I should paste in to explain. --------------- Added [DATE]1381881251[/DATE] at [TIME]1381881251[/TIME] --------------- Also since the 4.2.2 patch I removed the tabs hack and changed to navigation manager, using "member" as the group to see most tabs. so when I go to the new page the menu(tabs) also switch to logged out mode. however clicking the home link, or back puts you back to logged in status. |
Quote:
I tried to make it work but I produced db errors in the process. Info: I have one row now, but I anticipate in the future many rows, each one containing 7 columns. And in this routine I wish to list on my page all the rows. So this is what I did with your suggestion.... Code:
$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history"); But this doesnt work nicely with sql. My apologies for being not so sql inclined, and I dont wish to burdon you with 'teaching' me how to make this work, but I am not so skilled at database manipulation. (I am hoping to learn how to make this work so I wont be such a bother in the future) --------------- Added [DATE]1381977398[/DATE] at [TIME]1381977398[/TIME] --------------- I have decided I am going to do a crash course on sql. I need to be able to do more than hope someone here can hold my hand making something that would otherwise add several pages in this thread. The above responces have indeed helped me, but what I am trying to create is going to be propietary to my website, and I am stumped on just the first section of it out of several. It is my responsibility to educate myself so my questions remain more attached to the subject. Lynne, you have been a great help especially with this tutorial. This is in fact an amazing addition to anyone that wishes to do custom pages using templates, php, etc, on a forum setup. Thanks again. |
Quote:
A little stuck on this? --------------- Added [DATE]1382201159[/DATE] at [TIME]1382201159[/TIME] --------------- And if just by a little fairy dust of posting that if came too me what I did wrong. lol |
1 Attachment(s)
Hello;
I am creating an image-hosting website for which I require custom pages. This page serves the purpose, but I notice that it does not automatically re-size like the other vBulletin pages (see attached). For example, my main desktop monitor has 1920 screen resolution, whereas the ancient laptop I am on right now only has 1024 screen resolution. When I view the vBulletin forum on the smaller screen, everything is automatically re-sized so that it fits my 1024 resolution screen. (it even gets re-sized to fit my smartphone screen. However, my custom page does NOT automatically re-size, and so the excess images/text kind of "spills over" to the right (again see attachments for a comparison). So my question is, how do I construct my custom pages so that they too automatically re-size to fit smaller screens? Thanks for any help, Jack |
My guess: Do you use a mobile style? If that is the case, you need to have a fitting template for your cutom page in your mobile style.
|
Quote:
For example, there is no mobile style being used when I click the forum tab, yet the forum.php page automatically resolves to fit the resolution of my smaller screen ... yet this same thing does not happen when I click my ImageHosting tab and get my imagehosting.php page. In no case have I employed my mobile style. I have used my own customized style, yet some kind of coding is in my forum.php page that is not in my custom php page, and that "something" is what I am inquiring about :) Thanks again, Jack |
Quote:
|
Quote:
I don't know. Possibly, yes. We have different-sized thumbnails: tiny, small, medium, large, jumbo (150 px, 400 px, 800 px, 1200 px, and 2500 px). I just use the template, and so maybe there can be some kind of "flexible" coding employed that adjusts??? Thank you. |
Quote:
|
Quote:
To perform within the models. |
Quote:
|
One of the things I noticed on this "custom page" is that photographs which are put on the page do NOT display on Facebook ... whereas they DO display on default vBulletin pages.
For example, if I have a photo on a Forum post, or a Blog Post, or an Article post ... and if I place the URL to that post/article on Facebook ... I get a choice of photo thumbnails to choose from, to associate on Facebook, which includes the photos that I want displayed. But that does not work for this custom page here. When I post the URL of any page I create with this template on FB, my choice of thumbnails only shows the vBulletin Logo or my Avatar ... any photos I post are not available. What do I have to do to change this? When I have a photo on this custom page, and if I post the URL to it, I want my photos to be among the thumbnail choices I have. How can I accomplish this? Thanks, |
That would be outside the scope of the article, since that's a Facebook thing. You would need to look at their documentation or articles such as this one for what you need to do control how thumbnails show up.
|
Quote:
|
So how do I pull a php file in the models. Why can not I use php code.
|
First, thanks for the tutorial!
OK, this is probably a really silly question. My template isn't fully parsing HTML. The test is fine, and a href links are fine. But line breaks and bullet points are being ignored. Here's an example: http://www.enworld.org/forum/features.php?styleid=14 It's ignring all the <ul>s and the <li>s. Any idea why that might be? |
Quote:
|
Quote:
--------------- Added [DATE]1384439034[/DATE] at [TIME]1384439034[/TIME] --------------- OK, so a search for "HTML" gives a lot of results. The closest I can find is where yous ay to ad the following "to the custom CSS for your page". What does "the custom CSS for your page" mean? The only CSS stuff I'm familiar with is a bunch of CSS templates and a Main CSS editor thing. Where do I put the custom CSS for my page? Quote:
--------------- Added [DATE]1384452204[/DATE] at [TIME]1384452204[/TIME] --------------- It's just occurred to me that I can accomplish the same effect with a CMS article in its own section. I'm not sure why that didn't occur to me before. |
Quote:
|
Quote:
I've poked around, and while there are CSS templates for *some* pages, named xxxx.css in the styles/template manager, there obviously isn't one for the new page unless I create it myself. Plus there's a whole "Main CSS" option in the style manager. That all said, I just went with the article approach in the end. It looks pretty tidy if you strip away a lot of the surrounding stuff. |
Just add your custom CSS for that page to the template for the page.
|
Quote:
|
How would I go about adding an external web link to appear in the page, similar to how panjo appears
thanks |
This is great. Just need to sort out my text coding and it will be sweet. Might even solve a few annoying errors I've had by using CMS articles as pages instead of custom pages.
|
Will love to see this working on v5
|
Hi, I'm new on this, and I'm having trouble to create a page out off the Forum root, inside the root everything is fine, but out side is without CSS...
My Forum is in: /var/www/forum My page is in: /var/www/tests.php This is my code... Code:
Code:
|
you need to set an 'include' phrase that 'points' to the location of your css file
|
Could you show me?? As I say, I'm new on this, and don't have idea where is the CSS of Vbulletin...
|
1 Attachment(s)
Quote:
Hello again, I am creating a photography database application, so sharing pictures is an absolute must. When a person is on the "view pic" page, a facebook link is there as well so that the person can share the pic on facebook. I am able to share the post to the person's wall, successfully, but instead of presenting a thumbnail of my desired photo, all that is being posted is a thumbnail of my forum logo. I cannot figure out how to override this and include the desired picture in the Facebook popup for posting. I tried to follow the instructions on your link, and it simply doesn't work. It's beyond a FB problem, it's intrinsic to vBulletin, and it's driving me nuts. Before I make the dynamic solution to this problem, my goal is to first establish a static proof-of-concept. Here is the html I am using in the root directory. Notice I am intending on using the Facebook OpenGraph tool to a linked picture: It is as if all the custom "meta" tags are being completely ignored by something inside vBulletin. How can I include a custom pic in my Facebook Shares? Your help is greatly appreciated. Code:
<html> This is the picture that SHOULD be appearing on the Share: http://www.macrophotopro.com/thumbna...00548_tiny.jpg However, the attached below (my forum logo) is what's actually getting displayed. What do I have to do to get the desired pic to override the default posting of the logo? Help is greatly appreciated! |
Right now, if I go to your site, you have it turned off. That means an Unregistered user may not see a thing. And, if you are testing your script while it is turned off, remember that Facebook is an Unregistered User and so the only image they can grab is your logo.
|
Quote:
I am not sure I made myself clear. What we're trying to do has nothing to do with a person being registered, logged-in, or anything like that. This has to do with a Facebook "share" button on our custom page NOT being able to share a desired image onto FB. A person should NOT have to be registered onto my site, at all, for the share button to work nor for the image to be displayed. The share button works, and the image should display because of the coding, but yet it is not. I do understand what you're saying about the forum being turned off, but we did test the procedure with it turned on, and still got the logo, not the desired image. The meta content is structured so that the spider image should display, but yet only the logo displays. I believe vBulletin has some static, overriding code to where only vBulletin's logo displays (or whatever logo is up there), and we are trying to circumvent or identify this code and change it. It should have absolutely nothing to do with whether a person is logged in to our site or not. In fact, the whole idea is to advertise to NON customers of our site, to Facebook, so they can click on the FB image and be taken back to our site. These people will not be customers, so their being logged in should have no bearing on seeing the image or not. We believe we have the coding correctly ... we have the reference to the correct thumbnail ... yet it's showing only the logo. What overriding code to we need to get rid of to get what we want displayed, displayed? Thanks and I hope this was clear :) Jack PS: Click this link, click the FB button, and see what I mean: http://www.macrophotopro.com/fb.html |
Hello ...
|
All times are GMT. The time now is 05:25 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|