Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
A rather silly question I am embarressed to ask.. (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: A rather silly question I am embarressed to ask..
#1004
Macfionn (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
A rather silly question I am embarressed to ask.. 2 Years, 6 Months ago Karma: 0  
Upon creating a classifieds.php page, I inserted the following code:

<?php echo sefRelToAbs('index.php?option=com_php&Itemid=1'); ?>
<?php global $mainframe;   
    include($mainrame->getCfg('absolute_path').'/home/user/public_html/mysitename.com/classifieds/index.php'); ?>
<?php echo josURL('index.php?option=com_php&Itemid=1'); ?>
I then recieve this error:
QUOTE:
http://www.mysitename.com/index.php?Itemid=1 Fatal error: Call to a member function getCfg() on a non-object in /home/user/public_html/mysitename.com/components/com_php/files/classifieds.php on line 3
So my question is two fold: 1: "CAN" I call the index.php page of a third party script (Noahs classifieds) and have it work here? 2: If I can, what am I missing for the proper call so I do not get the error? And PLEASE forgive the basicness of this question, Im learning as i go... Mac
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1005
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:A rather silly question I am embarressed to ask.. 2 Years, 6 Months ago Karma: 10  
Hello Mac,

Yes, you can include a 3rd party script like Noah classifieds. Usually, it isn't straight forward though, as there can be a few issues, conflicts etc. to resolve to make it work.

Anyway, the actual error you have is just a typo. You spelt $mainframe, $mainrame.

As for including 3rd party files:

Before anything, make sure that all errors are displayed.

ie: ini_set('error_reporting', E_ALL );

Then you have to make sure all files needed by the 3rd party script are included.
You may also want to change the working directory (directory the php process is executing in) to the directory Noah's index.php is in.

eg: chdir('/home/user/public_html/mysitename.com/classifieds/' );

Just before you include the file. Then you can just include it like: include('index.php' );

You'll need to change back to Joomla's base after you include.

Those two should usually do the trick.
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/07/27 05:19 By admin.
  The administrator has disabled public write access.
#1012
Macfionn (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
Re:A rather silly question I am embarressed to ask 2 Years, 6 Months ago Karma: 0  
Thank you for replying, and I am sorry I have not.
Ive been quite a bit ill the past week and half.

But, as demonstrated by my being here, doing much better.

On to task, Could you show me an example of what you typed above?

Lets say the file I am wanting to open is: http://www.mysite.com/radar/index.php

How would I properly form the code beow showing the 3 elements you suggested, as well as my code?
And THEN "change back to Joomla's base after you include."

ini_set('error_reporting', E_ALL );
chdir('/home/user/public_html/mysitename.com/radar/' );
include('index.php' );

<?php echo sefRelToAbs('index.php?option=com_php&Itemid=1'); ?>  
<?php global $mainframe;     
     include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/classifieds/index.php'); ?>  
<?php echo josURL('index.php?option=com_php&Itemid=1'); ?>
Really... I am sorry for sounding daft.
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/08/03 09:45 By admin.
  The administrator has disabled public write access.
#1013
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:A rather silly question I am embarressed to ask 2 Years, 6 Months ago Karma: 10  
You're on the right track. See the added chdir() in the code.


ini_set('error_reporting', E_ALL );
chdir('/home/user/public_html/mysitename.com/radar/' );
include('index.php' );
chdir('/home/user/public_html/mysitename.com/' );

<?php echo sefRelToAbs('index.php?option=com_php&Itemid=1'); ?>  
<?php global $mainframe;     
     include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/classifieds/index.php'); ?>  
<?php echo josURL('index.php?option=com_php&Itemid=1'); ?>

I'm assuming /home/user/public_html/mysitename.com/ is your Joomla directory.

You could also use getcwd():
ini_set('error_reporting', E_ALL );
$joomla_dir = getcwd();
chdir('/home/user/public_html/mysitename.com/radar/' );
include('index.php' );
chdir($joomla_dir);

<?php echo sefRelToAbs('index.php?option=com_php&Itemid=1'); ?>  
<?php global $mainframe;     
     include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/classifieds/index.php'); ?>  
<?php echo josURL('index.php?option=com_php&Itemid=1'); ?>
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1014
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:A rather silly question I am embarressed to ask 2 Years, 6 Months ago Karma: 10  
I missed that you have

<?php global $mainframe;       
     include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/classifieds/index.php'); ?>

In there also. You should do the same as you did with /home/user/public_html/mysitename.com/radar/index.php with that code.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1015
Macfionn (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
Re:A rather silly question I am embarressed to ask 2 Years, 6 Months ago Karma: 0  
sighs.
Ok.. im entering this as i see it here, and getting nothing but errors.
I know if I can just get one page working, I can then bring in the classifieds and such using the same model.

I see so many php tags in the above examples. How many are needed?
Please use your keen eyes as I lay this out. If you see anything wrong, please catch me:

QUOTE:

<?php

ini_set('error_reporting', E_ALL );
$joomla_dir = getcwd();
chdir('/home/user/public_html/mysitename.com/weather/' );
include('index.php' );
chdir($joomla_dir);
echo sefRelToAbs('index.php?option=com_php&Itemid=1');
global $mainframe;
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/hw3.php
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/local_header.html');
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/current.html');
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/astro.html');
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/nav_state.html');
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/header.html');
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/zone_rows.html');
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/zonesection.html');
include($mainframe->getCfg('absolute_path').'/home/user/public_html/mysitename.com/weather/footer.html');
echo josURL('index.php?option=com_php&Itemid=1');

?>


Heres the bottom line. I have installed hamweather 3 from hamweather.com

These are the includes per this site: http://www.hamweather.com/kb/index.php?article=16:

local_header.html
current.html
astro.html
nav_state.html
header.html
zone_rows.html
zonesection.html
footer.html

And this is based on the conversation here:
http://support.hamweather.com/viewtopic.php?f=17&t=7971&hilit=joomla

If you were doing this yourself, how would you do it? Im very sorry to ask, im just at wits end making this work. :/
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/08/04 12:28 By Macfionn.
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.