I am trying to get the variable (“&Id= Id number (ex.&Id=25)”) to be part of the $url string in code, with it taking the ID from the http:// url to page in browser that is being passed from user page link.
All I need is to collect the “Id” see code below tell me what I am missing or need to add please
I added this line and it is worng ‘$url.=$custom.’&Id=$id’;’
/* Getting parameters like task, view, layout, etc. */
$re1='.*?';
$re2='(?:[a-z][a-z0-9_]*)';
$re3='.*?';
$re4='((?:[a-z][a-z0-9_]*))';
$re5='.*?';
$re6='((?:[a-z][a-z0-9_]*))';
if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4.$re5.$re6."/is", $view, $matches)){
$type=$matches[1];
$layout=$matches[2];
}
/* end */
/* Creating URL */
$url=JURI::root().'index.php?'.$component.'&tmpl=component&print=1';
for($i=1;$i<count($type);$i++){
$url.='&'.$type[$i].'='.$layout[$i];
}
$url.=$custom;
//$url.=$custom.'&Id=$id';
/* End */
/* Getting current User Logged in Session ID and First Album Id */
$session=&JFactory::getSession();
$session_id=$session->getId();
$id=$session->getId();
/* End */
/* Starting curl session */
$c_open=curl_init();
curl_setopt($c_open, CURLOPT_URL , $url);
curl_setopt($c_open, CURLOPT_HEADER, 1);
curl_setopt($c_open, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($c_open, CURLOPT_COOKIE, session_name().'='.$session_id );
// Passing session ID.
You don’t need to use & - You do not need to use htmlentities type output unless you want to display certain symbols on the webpage which the browser would normally see as source code.
Instead just use the & by itself. EG:
&id=$Id
I wrote $url.=$custom.‘&Id=$id’;
It produces no errors but does not print out or get the vairable in http:// Id=25 or Id=26, etc…
How to get the URL in the borwser http;// ID to be collected into the
$url.=$custom;??
PLEASE HELP
I am defining the vairbale as jrequest from browser but it is not taking and putitng the ID=25, id=26, etc… in the code $url=cusomt…
HELP
// no direct access
defined('_JEXEC') or die ('Restricted access');
/* Getting Parameters */
$component= $params->get('component','');
$view= $params->get('views','');
$custom=$params->get('custom','');
$auto=$params->get('autojscss','0');
$js=$params->get('customjs','');
$css=$params->get('customcss','');
$head_js=$params->get('custombodyjs','');
$head_css=$params->get('custombodycss','');
$id = JRequest::getVar($prefix . 'id') ;
/* End of Parameters */
$type=array();
$layout=array();
if($component!=''){
/* Getting components parameters like task, view, layout, etc. */
$re1='.*?';
$re2='(?:[a-z][a-z0-9_]*)';
$re3='.*?';
$re4='((?:[a-z][a-z0-9_]*))';
$re5='.*?';
$re6='((?:[a-z][a-z0-9_]*))';
if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4.$re5.$re6."/is", $view, $matches)){
$type=$matches[1];
$layout=$matches[2];
}
/* end */
/* Creating URL */
$id = JRequest::getVar($prefix . 'id') ;
$url=JURI::root().'index.php?'.$component.'&tmpl=component&print=1';
for($i=1;$i<count($type);$i++){
$url.='&'.$type[$i].'='.$layout[$i];
}
//$url.=$custom;
$url.=$custom.'&Id=$id';
/* End */
Get rid of the single quotes.
Single quotes are strings which php does not need to do anything with.
Double quotes php will parse and replace variables with their values.
//Wrong - single '
$url = $Custom .='&id=$Id';
//Output &id=$Id
//Correct - Double "
$url = $Custom .="&id=$Id";
//Output &id=25