i create a page with this learning
now how can i change this page to a product? |
Quote:
|
Quote:
So I went into my PHP code and replaced the echo with: $test1 = "..." I then tested it by adding echo "$test1" and that worked. So then I tried adding this variable to the template but this is where I am having no luck. Here is what I have in the template: Code:
{vb:stylevar htmldoctype} |
You need to pass it to the template.
Add this before the print_output($templater->render()); line: PHP Code:
|
Quote:
PHP Code:
Also if I want to then add another variable I can just do the same thing? Add another line PHP Code:
and add the vb code in the template? |
Yes, you can do that for as many variables as you like.
Regarding your problem that only the last line is shown: In your while loop, you're overwriting your $test1 variable with every single loop, so only the result of the last one is returned in the end. You need not use $test1 = "whatever", but $test .= "whatever". This will not overwrite the existing value of the variable, but preserve the old value and add the new value at the end of the string. |
Quote:
One last problem I have. As I am trying to pull threads from X days ago, for some reason the date seems to be one day off. Here is what I have defined for x days ago: PHP Code:
|
You really need to open your own thread for this - this has nothing to do with this tutorial.
|
I've followed this tutorial to a 'T' (as far as I can tell) yet the php file I'm trying to call (a newsletter form submission) won't load within the template.
I created newssubscription.php and put it in my forum folder. Code:
<?php Code:
{vb:stylevar htmldoctype} Code:
ob_start(); |
There are no plugins in the test.php page. You need to put the php into the test.php page. Plugins are for modifying files you don't want to actually modify. When you create your own php page, you need to put all php in there because they don't use plugins.
|
Quote:
On a side note, here is something related to this. So I was able to add a new page with the template. Looks great except one thing. There is some extra space on the top of the page so now my logo and login is moved down and there is about a 1/2" gap of nothing from the top. This is only on the new external php page I created. All my other pages look fine. Any suggestions? |
That's either something in the PHP-Code or in the template you created, or some stray css. Without knowing the code and/or seeing the page that's just guesswork.
|
Quote:
|
I got my vB page working. It's a newsletter subscription form, real simple. A user enters an email address, enter the security code and that's it. Problem is vB bounces back with
"Your submission could not be processed because a security token was missing." If I turn off CSRF_PROTECTION to FALSE the problem goes away, but I'm leery of disabling anything that is titled PROTECTION. I found some posts saying that I should add Code:
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> (If this should be a new thread then I apologize for doing it here. Feel free to move if necessary.) |
Quote:
Code:
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" /> |
Does this go in the template I created or in the .php file? Because if it's the template it doesn't seem to be working. I have it in the blockrow area. Does it go somewhere else?
--------------- Added [DATE]1310697032[/DATE] at [TIME]1310697032[/TIME] --------------- I've pinpointed the problem. It's value="$bbuserinfo[securitytoken]" that's causing the problem. If I change it to "guest" it works fine, but only if the user isn't logged in. Is there a way to get this working so if it's a non-member/not logged in member or a logged in member it behaves the same way? What if I just disable CSRF_PROTECTION for this particular script? |
The code I posted goes into the form which should be in the template. I took the code directly out of the header template - if you have written it correctly, it will work for a guest or member.
|
I wrote a simple product that allows you to embed Google Custom Search using this approach.
https://vborg.vbsupport.ru/showthread.php?t=266449 It is really just a page shell + tab, feel free to grab the code as you need. Kym |
Quote:
Quote:
If I can't get it working I'll just go with turning off the protection. It works for both then, and the form has two security measures of it's own so I think it's fairly safe. |
Quote:
HTML Code:
<input type="hidden" name="securitytoken" value="<?php global $vbulletin; echo $vbulletin->userinfo['securitytoken']; ?>" /> This would be easier if, as someone pointed out in the other thread, you were to put your form in a template, but that would mean making more changes to the form code. |
Thanks for the suggestion, but I get:
Parse error: syntax error, unexpected '"' I tried it in the code starting the form, as well as by the submit button. |
That could be because I'm an idiot and I did it to you again - I got the tags backward. I fixed it above if you want to try again. (This time I actually tried it myself).
|
Quote:
|
Hello Lynne, sorry if this is off topic but is there any way anyone can point me in the right direction to be able to add options to these custom pages that we can control through the admin panel? I can't seem to find any documentation on that. I know how to add the setting group via debug mode through admin panel but that's as for as I go, I don't know how to implement them into my script. Any help or guidance to implement that into my custom pages would be very helpful. Thanks for your time everyone.
|
Quote:
|
Quote:
|
You would put the code to put the forums in there. You need to be able to do some php if you want to create a php page. The code for forums is in the forum.php page. If you don't want forums to show on the main page, set the display value to 0.
|
Quote:
in the forum.php? Also, where would I put that code in the test.php file above? |
Quote:
|
Quote:
|
Thanks you very much
|
After searching this thread for keyword: navbar - I found I'm having the same issue as this person:
https://vborg.vbsupport.ru/showpost....&postcount=585 The directions are excellent - I've encountered no errors. But, I must be doing something wrong, because I can't get the page to appear in the navbar :confused: I can pull it up -directly- just fine, by typing www.mydomain.com/test.php Any help appreciated. Thank you |
Quote:
|
how do i close this page for only registered members?
Please help me. Kind regard, Marco. |
Quote:
PHP Code:
|
Quote:
I mean exactly place in the php page. |
Quote:
PHP Code:
|
Thanks alot my dear friend :)
|
1 Attachment(s)
Hi all,
Great guide and created a number of pages for my site... However, when using IE8 there appears to be a problem with the navbar, but only for the pages that I have created using this tutorial... All others the navbar is fine... (Unfortunately a lot of the government departments in Australia are still using IE8 - so this effects a lot of my users) Attached are a couple of images...the first with the navbar display issues and the second of how they should be... Funny thing is that this is only for 'guests' and once logged in as a registered user, it's all good...(as per the second screen shot) Lynne - need your help please...issues only seem to be present when using pages created with your 'how to'... site: www.aiyj.org Any suggestions to fix this would be very much appreciated! Cheers, Ian |
Ian, can we get a link to the custom page to see the problem? The custom pages I found through your navtabs all look fine to me. Or, is this a problem only when you are logged in?
|
All times are GMT. The time now is 07:57 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:
|