Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 10-08-2008, 05:00 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then you need something like in vBa CMPS that does a search and replace I guess.
Reply With Quote
  #12  
Old 10-09-2008, 02:49 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DandD View Post
Hi Dismounted,

Thanks for the thoughts. Admittedly I am a novice, so please bear with me. It seems the problem is due to relative paths in all the files. The site home page (the page in question) is in the root folder. The calendar.php file is in the /forum/ folder. If I understand your suggestion correctly, I can copy the calendar.php code into the home page rather than using an include. I tried this and modified the paths on all the includes for that file accordingly. But we then have the same problem with the first file called down the line - in this case my modified code can now find /forum/global.php but returns an error because /includes/init.php can't be found. I would then need to modify the path in global.php and so on back to who knows where. That seems more than a little convoluted, not to mention opening the door to other issues.

Hopefully I am missing something simple. As you can tell I could really use some guidance.

Thanks for any help.
David
As Marco has said - you can use chdir(). This will change the working directory to whatever you want.
Reply With Quote
  #13  
Old 10-09-2008, 06:42 AM
DandD DandD is offline
 
Join Date: Sep 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
As Marco has said - you can use chdir(). This will change the working directory to whatever you want.
Hi Dismounted,

I really appreciate your help. This has been quite strange. I was repeatedly getting error codes when trying to use the chdir but now I'm not and everything seems to be working with the exact same code I tried before. I mean exactly. There is one other problem now: I have additional html on the page after the php tags which simply does not show up now, not on the page, not on the page source code. Is there a trick I'm missing?

Edit: I spoke too soon. Before I would get the errors in Firefox immediately and eventually in Safari. Tonight all seemed well in Safari, even after clearing the cache. In Firefox, I again get the error message:

Unable to add cookies, header already sent.
File: /home/xxxx/public_html/index-test.php
Line: 2

Here is the entire code I'm trying now:

<base href="forum/" />
<?php chdir('forum/'); ?>
<?php include ("calendar.php"); ?>

(If I don't use the base href the css does not work. I even tried a link href for the .css file instead but it does not work.)

This is the page: http://www.lahabraevents.com/index-test.php

I feel like I am going crazy. Obviously, I could use any help you could offer. Much thanks.
David
Reply With Quote
  #14  
Old 10-09-2008, 07:04 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add your base element in the headinclude template, and use an absolute URL (http://www.site.com/forum). Use absolute paths (i.e. /home/user/public_html) for chdir().
Reply With Quote
  #15  
Old 10-09-2008, 08:51 AM
DandD DandD is offline
 
Join Date: Sep 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
Add your base element in the headinclude template, and use an absolute URL (http://www.site.com/forum). Use absolute paths (i.e. /home/user/public_html) for chdir().
Dismounted,

I feel like I should apologize for taking your time. You have been most gracious. I would like to think we are making progress. I added the base element to the headinclude template using the absolute URL as suggested. I added to the index-test.php page:

chdir('/home/xxxx/public_html/forum')

The CSS worked in Safari but not Firefox on the index page. I added a link href to the .css file in the index page and now that works (I had to use the absolute URL, relative did not work).

I no longer get error messages and my html footer now displays again. Unfortunately, the original issue remains. The user login status and the calendar view links do not display correctly. I am wondering if this is related to the include itself. If I use a relative path, the page does not work, I only get error codes. The code now is:

include ("http://www.lahabraevents.com/forum/calendar.php");

If you have a magic wand to make this work, I would be most appreciative.

Thanks again,
David
Reply With Quote
  #16  
Old 10-09-2008, 09:15 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And the errors are?...
Reply With Quote
  #17  
Old 10-09-2008, 04:58 PM
DandD DandD is offline
 
Join Date: Sep 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
And the errors are?...
With this current code, no errors but still the original issues:

headinclude
base href="http://www.lahabraevents.com/forum/"

index-test.php
chdir('/home/xxxx/public_html/forum')

link href="http://www.lahabraevents.com/forum/clientscript/vbulletin_css/style-b391d83b-00002.css" rel="stylesheet" type="text/css"

include ("http://www.lahabraevents.com/forum/calendar.php");

Error
If I change the include to a relative path, I get the same errors I have been fighting.

include ("calendar.php");

Error:
Unable to add cookies, header already sent.
File: /home/xxxx/public_html/index-test.php
Line: 7

Hopefully I am missing something simple.

Thanks again,
David
Reply With Quote
  #18  
Old 10-09-2008, 05:18 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is very hard to tell what you have done since you are not using the php or html tags to quote exactly what you code is. One thing I have noticed it your chdir is not ending in a slash and then your include is not starting with a slash. Perhaps that is a problem? I would try:

PHP Code:
chdir('/home/xxxx/public_html/forum');
include (
"./calendar.php"); 
Reply With Quote
  #19  
Old 10-09-2008, 06:12 PM
DandD DandD is offline
 
Join Date: Sep 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
It is very hard to tell what you have done since you are not using the php or html tags to quote exactly what you code is. One thing I have noticed it your chdir is not ending in a slash and then your include is not starting with a slash. Perhaps that is a problem? I would try:

PHP Code:
chdir('/home/xxxx/public_html/forum');
include (
"./calendar.php"); 
Hi Lynne,

Thanks for the suggestion. I have tried so many variations I have ended up going in circles. The above gives the same error code. If I add a slash to the end of the chdir path and use any relative path variation for the include, same error. If I add a slash to the chdir path and use the absolute path for the include, no error but the original issue exists. Examples:

1
PHP Code:
chdir('/home/xxxx/public_html/forum'); 
PHP Code:
include ("calendar.php"); 
Error
Unable to add cookies, header already sent.
File: /home/xxxx/public_html/index-test.php
Line: 7

2
PHP Code:
chdir('/home/xxxx/public_html/forum'); 
PHP Code:
include ("/calendar.php"); 
Error
Warning: main(/calendar.php) [function.main]: failed to open stream: No such file or directory in /home/xxxx/public_html/index-test.php on line 8

Warning: main(/calendar.php) [function.main]: failed to open stream: No such file or directory in /home/xxxx/public_html/index-test.php on line 8

Warning: main() [function.include]: Failed opening '/calendar.php' for inclusion (include_path='.:/usr/lib/php') in /home/xxxx/public_html/index-test.php on line 8

3
PHP Code:
chdir('/home/xxxx/public_html/forum'
;
PHP Code:
include ("./calendar.php"); 
Error
Unable to add cookies, header already sent.
File: /home/xxxx/public_html/index-test.php
Line: 7

4
PHP Code:
chdir('/home/xxxx/public_html/forum'); 
PHP Code:
include ("/home/xxxx/public_html/forum/calendar.php"); 
Error
Unable to add cookies, header already sent.
File: /home/xxxx/public_html/index-test.php
Line: 7

5
PHP Code:
chdir('/home/xxxx/public_html/forum'); 
PHP Code:
include ("http://www.lahabraevents.com/forum/calendar.php"); 
Page displays, no errors, but original issues unresolved.

thanks,
David
Reply With Quote
  #20  
Old 10-09-2008, 08:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But, what is your entire code? Unable to add cookies usually means you have it doing 'header-type' stuff twice. Once you start to write your page, you can't go back and try to set a cookie again. So, it could be that you are doing things out-of-order in your page. You may have to try rearranging your php.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 01:26 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04591 seconds
  • Memory Usage 2,284KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (12)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete