Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 21 Mar 2011, 22:05
ninadbe ninadbe is offline
 
Join Date: Mar 2011
postbit_legacy template editing error

I am editing postbit_legacy at "template" table. I want to displaye some images extracted from remote server after 1st post.
My code is as follows

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

After editing postbit_legacy with above customized code, I am getting following error


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

When remote server connection string code is removed, I am not getting any errors.

It seems like I am getting error because existing connection is active


Please help me with this problem.

Thanks
Reply With Quote
  #2  
Old 21 Mar 2011, 23:56
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
I'm not sure exactly what you are saying, but you said your were editing the template via the table? Do you mean you were editing it directly in the database? Please don't do that. You should be editing it via the admincp > style manager > find style > edit templates. Also, you cannot put php in templates. Templates are for html only. If you need the output from some php to show up in a template, then you need to create a plugin to run the php code and assign the output to a variable that you would then put into the template.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #3  
Old 22 Mar 2011, 00:05
ninadbe ninadbe is offline
 
Join Date: Mar 2011
Yes I were editing templates at database through phpmyadmin.

Is there any help topic regarding how to create plugin and implement output in template?
Reply With Quote
  #4  
Old 22 Mar 2011, 00:16
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
I would suggest download a mod that does that to see how it was done. I'm not sure if there is a help topic because I haven't actually looked for one, but you can take a look in the vB4 Articles forum for one.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #5  
Old 23 Mar 2011, 17:45
ninadbe ninadbe is offline
 
Join Date: Mar 2011
Can you please suggest me any plugin that uses remote database connection or use to extract data from other server?
We have vbulletin forum for our site, but our site is located on one server and forum located on another server in order to avoid load.
I want to extract data from main site (which is located on another server) and display it on forum.

I tried lot , searched everywhere. But I not found any specific plugin / mod.

I created custom plugin on my own but it giving errors like
"MySql client ran out of memory"
"Invalid key error"

Please any help would be appreciated.

Thanks
Reply With Quote
  #6  
Old 23 Mar 2011, 18:10
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Connecting to the database is something you set up in the config.php file. If it is set up correctly there, then you just make a database call and the config.php file points to the correct database. (I have my database on a different server and it works just fine).

Those errors you posted - running out of memory and invalid key error, are server errors and you should talk to your host about them.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #7  
Old 23 Mar 2011, 18:24
ninadbe ninadbe is offline
 
Join Date: Mar 2011
I am connecting to the my main site database not vbulletin database.

My vbulleting forum and database are on same server , but main site and its databse are on another server.

I linked forum with main site via Menu Tab.

At config.php I think there is setting for vbulletin database.
Reply With Quote
  #8  
Old 23 Mar 2011, 18:38
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Then I guess you will need to do this via the mysql_connect that you were talking about earlier. You cannot put it in a template though. You will need to put php in a plugin. I doubt there is any example here that actually shows to php to use for your specific situation of connecting to an external database. You will have to just use regular php/mysql for that.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #9  
Old 23 Mar 2011, 18:58
ninadbe ninadbe is offline
 
Join Date: Mar 2011
Yes thats what I have been trying since last, created plugin , hooked it at "SHOWTHREAD" , "postbit" template.

I also tried to include file with following code


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Above code gives error


following code do works 60%

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

However if I tired above code it works fine. It showing product successfully. But problem is that, I want to show products related to forum title. Therefore why I passed parameters along with it as

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

but its not working.


It is not passing parameter successfully.

--------------- Added 23 Mar 2011 at 19:09 ---------------

session variables are not working.
Do you it would work with cookie variable? i.e store threadtitle with the help of cookie.

--------------- Added 23 Mar 2011 at 20:45 ---------------

ob_start();
$threadtitle = $threadinfo['title'];
setcookie('threadtitle111',$threadtitle);
require_once('http://naturalparenting.com.au/prod_gallery.php');
$prods = ob_get_contents();
ob_end_clean();
vB_Template:reRegister('postbit_legacy',array('prods' => $prods));


Dont know why setcookie not working at vbulletin?

Last edited by ninadbe; 23 Mar 2011 at 20:45. Reason: Auto-Merged DoublePost
Reply With Quote
  #10  
Old 23 Mar 2011, 22:01
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
I do not understand all all what you are doing. If you are putting that code in a plugin, you need to tell us what hook location you are using. - there is no such thing as "hooked it at "SHOWTHREAD" , "postbit" template". You don't hook to a template.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #11  
Old 23 Mar 2011, 22:19
ninadbe ninadbe is offline
 
Join Date: Mar 2011
hook : global_start

at postbit_legacy => {vb:raw prods}


It is working, only facing problem with cookie.
I have changed
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

as setcookie is not working. vbsetcookie works.

It seems like cookies at vbulletin are encrypted.
So cannot fetch cookie at location.

Last edited by ninadbe; 23 Mar 2011 at 22:26.
Reply With Quote
  #12  
Old 23 Mar 2011, 22:23
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
I would not pick the global_start template. If you look that template up, you will see it is deprecated and you are supposed to use another one instead (I can't remember which one, but you are told when you look that one up).
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #13  
Old 23 Mar 2011, 23:34
ninadbe ninadbe is offline
 
Join Date: Mar 2011
I hooked it at showthread_start. Also tried hooking with global_bootstrap_init_start.

Plugin is working with all hooks I have tried so far (global_start, global_bootstrap_init_start, showthread_start etc). As I explained before mine problem is with cookies.

I have set cookies with the help of foolowing code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

As I said before vbulletin is encrypting cookie. Therefore I cannot get cookie value at included location.
Is there anyway to decode cookies?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 06:55.

Layout Options | Width: Wide Color: