Okay, I am trying to call the article id from the article which the form (using contentsubmit) posts. In my form, I also access the jos_menu table and inputs the preliminary information for the menu connection. The only thing I am missing is the path, which is why I need the article id.
I found that the Twitter extension has a php file which will automatically call the file and post it on twitter. I attached it. So I tried to take come of this code and add it into the form. Rough hack. I really have no idea what I am doing. I tried:
The $path is what I need. I added the variable into the code as well and when I test out my form I get:
Any thoughts? Or easier hacks?
I found that the Twitter extension has a php file which will automatically call the file and post it on twitter. I attached it. So I tried to take come of this code and add it into the form. Rough hack. I really have no idea what I am doing. I tried:
<?php
$database =& JFactory::getDBO();
$query = 'SELECT id FROM #__content ORDER BY id DESC LIMIT 1';
$db->setQuery( $query );
$rows = $db->loadObjectList();
/*
Create first element of address [place on server]
it is IMPORTANT if site is located in subdir😉
*/
$SERVER = $_SERVER['SERVER_NAME']; // www.serwer.com
$REST_OF_SERVER = $_SERVER['REQUEST_URI']; // /account_user/administrator/index.php
$SUB_DIR = '';
$tablica = explode( '/', $REST_OF_SERVER );
//Create Sub-dirs
for($x=1; $x<=count($tablica)-1; $x++)
{
$indeks='';
if( strlen($tablica{$x})>8 )
{
for($p=0; $p<=8; $p++)
{
$indeks.=$tablica{$x}[$p];
}
}
if( ( $indeks == 'index.php' ) || ( $tablica{$x} == 'administrator' ) )
$x = count($tablica)-1;
else
$SUB_DIR = $SUB_DIR.'/'.$tablica{$x};
}
$lastchar=substr($SUB_DIR, -1, 1);
if($lastchar!='/')
$SUB_DIR = $SUB_DIR."/";
//Create second element of address [directly location file]
$LAST_ID = $rows[0]->id;
$ARTICLE_ID = $LAST_ID+1;
require_once( JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php' );
$path = ContentHelperRoute::getArticleRoute( $ARTICLE_ID );
//Create full path of article
$address = 'http://'.$SERVER.$SUB_DIR.$path;
?>
The $path is what I need. I added the variable into the code as well and when I test out my form I get:
Fatal error: Call to a member function setQuery() on a non-object in /home/mytown5/public_html/components/com_chronocontact/chronocontact.php(421) : eval()'d code on line 32
Any thoughts? Or easier hacks?