Yii - renderpartial from module to root folder - yii

i am trying to render the view from module to project base view but it gives error.
I tried below combinations without any luck. It gives the error "DefaultController cannot find the requested view "appsMenu"."
echo $this->renderPartial("appsMenu",array("moduleName"=>""),true, true);
echo $this->renderPartial("//appsMenu",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("/protected/views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("/views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("//protected/views/site/appsMenu",array("moduleName"=>""));
and tried with extensions too
echo $this->renderPartial("appsMenu.php",array("moduleName"=>""),true, true);
echo $this->renderPartial("//appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("/protected/views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("/views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("//protected/views/site/appsMenu.php",array("moduleName"=>""));
I am in "Forms" module and trying to render a file "protected/views/site/appsMenu.php". Plz help me..

Use //:
$this->renderPartial("//site/appsMenu");
This can be seen in the documentation
absolute view within the application: the view name starts with double slashes '//'. In this case, the view will be searched for under the application's view path. This syntax has been available since version 1.1.3.

This nasty little bit did the trick for me
$this->renderPartial('//../modules/MyMod/views/MyCon/MyView');
Using // to alias to $root/protected/views and then putting that ../ bit in there to get me to $root/protected/views/../modules/$m/views/$c/$v which really means $root/protected/modules/$m/views/$c/$v
Of course, put reasonable values in for the $X and/or MyXXX values above.

require_once('./protected/modules/MyMod/views/MyCon/MyView.php');
Use above line if you are not able to render file using yii

Related

I am having trouble Echoing variables-Batch

So basically, all these variables are set to the PLUS symbol ( + )
Echo %1,10% %2,10% %3,10% %4,10% %5,10% %6,10% %7,10% %8,10% %9,10% %10,10%
Echo %1,9% %2,9% %3,9% %4,9% %5,9% %6,9% %7,9% %8,9% %9,9% %10,9%
Echo %1,8% %2,8% %3,8% %4,8% %5,8% %6,8% %7,8% %8,8% %9,8% %10,8%
Echo %1,7% %2,7% %3,7% %4,7% %5,7% %6,7% %7,7% %8,7% %9,7% %10,7%
Echo %1,6% %2,6% %3,6% %4,6% %5,6% %6,6% %7,6% %8,6% %9,6% %10,6%
Echo %1,5% %2,5% %3,5% %4,5% %5,5% %6,5% %7,5% %8,5% %9,5% %10,5%
Echo %1,4% %2,4% %3,4% %4,4% %5,4% %6,4% %7,4% %8,4% %9,4% %10,4%
Echo %1,3% %2,3% %3,3% %4,3% %5,3% %6,3% %7,3% %8,3% %9,3% %10,3%
Echo %1,2% %2,2% %3,2% %4,2% %5,2% %6,2% %7,2% %8,2% %9,2% %10,2%
Echo %1,1% %2,1% %3,1% %4,1% %5,1% %6,1% %7,1% %8,1% %9,1% %10,1%
but for some reason, this is the output:
,102,103,104,105,106,107,108,109,1010,10
,92,93,94,95,96,97,98,99,910,9
,82,83,84,85,86,87,88,89,810,8
,72,73,74,75,76,77,78,79,710,7
,62,63,64,65,66,67,68,69,610,6
,52,53,54,55,56,57,58,59,510,5
,42,43,44,45,46,47,48,49,410,4
,32,33,34,35,36,37,38,39,310,3
,22,23,24,25,26,27,28,29,210,2
,12,13,14,15,16,17,18,19,110,1
Could someone explain to me what's going on because I have no clue
(I did verify with the set command that the variables were set to the + symbol and they were)
Avoid starting variable names with a number, this will avoid the
variable being mis-interpreted as a parameter
Read Windows Environment Variables as well:
Variables have a percent sign on both sides: %ThisIsAVariable%
The variable name can include spaces, punctuation and mixed case:
%_Another Ex.ample% (This is unlike Parameter variables
which only have one % sign and are always one character long: %A,
%1 )
For instance, your first line:
Echo %1,10% %2,10% %3,10% %4,10% %5,10% %6,10% %7,10% %8,10% %9,10% %10,10%
rem ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑
rem % % = invalid variable name
rem nonexistent variables are evaluated to an empty string in batch script
rem ↑↑
rem %1 = the 1st command line parameter supplied to a batch script
rem evaluates to an empty string if no parameter is supplied
rem an isolated % percent sign is ignored ↑
evaluates to ,102,103,104,105,106,107,108,109,1010,10
Required reading (entire thread): How does the Windows Command Interpreter (CMD.EXE) parse scripts?
JosefZ did a good job explaining what is happening in his answer.
I have a couple more points just to further your understanding.
Batch parameters like %1 are only available within batch scripts. The command line has a slightly different parser that knows nothing about batch parameters. So your code will work as you intended if you enter the commands directly on the command line.
You can get your code to work as originally intended within a batch script if you enable delayed expansion:
#echo off
setlocal enableDelayedExpansion
Echo !1,10! !2,10! !3,10! !4,10! !5,10! !6,10! !7,10! !8,10! !9,10! !10,10!
Echo !1,9! !2,9! !3,9! !4,9! !5,9! !6,9! !7,9! !8,9! !9,9! !10,9!
Echo !1,8! !2,8! !3,8! !4,8! !5,8! !6,8! !7,8! !8,8! !9,8! !10,8!
Echo !1,7! !2,7! !3,7! !4,7! !5,7! !6,7! !7,7! !8,7! !9,7! !10,7!
Echo !1,6! !2,6! !3,6! !4,6! !5,6! !6,6! !7,6! !8,6! !9,6! !10,6!
Echo !1,5! !2,5! !3,5! !4,5! !5,5! !6,5! !7,5! !8,5! !9,5! !10,5!
Echo !1,4! !2,4! !3,4! !4,4! !5,4! !6,4! !7,4! !8,4! !9,4! !10,4!
Echo !1,3! !2,3! !3,3! !4,3! !5,3! !6,3! !7,3! !8,3! !9,3! !10,3!
Echo !1,2! !2,2! !3,2! !4,2! !5,2! !6,2! !7,2! !8,2! !9,2! !10,2!
Echo !1,1! !2,1! !3,1! !4,1! !5,1! !6,1! !7,1! !8,1! !9,1! !10,1!
But... even though you can technically use variable names that begin with a digit, I strongly advise that you should not do this.

storing current path in variable and reusing it

I know similar questions have already been asked, but somehow I am unable to figure out the mistake in my code.
I'm making a .bat file with the following code
echo off
echo %cd%
set curr_directory = "%cd%"
echo $curr_directory
pause
OUTPUT is :
C:\Users\MyDesktop>echo off
C:\Users\MyDesktop>
$curr_directory
Press any key to continue . . .
So what I dont get is why the value of variable curr_directory is not being printed.
What i eventually want to do is use the variable to change the directory something like this: cd $curr_directory
Thanks
I don't know where to start. EVERYTHING about your code is wrong. This should work:
#echo off
echo %cd%
set curr_directory=%cd%
echo %curr_directory%
pause
In batch you access variables via %var% and not $var. Further, DO NOT PUT SPACES behind =. SET x=123 will store 123 in x but SET x= 123 will store _123 (_ means space) in x.
EDIT: As SomethingDark stated, the first line should be #echo off except you actually want the message echo off to be printed. And yes, SET x = 123 means %x % is 123
use %curr_directory% instead of $curr_directory
Avoid spaces inbetween like the below one
"set curr_directory = %cd%"
below should work
echo off
echo %cd%
set curr_directory=%cd%
echo curr_directory is %curr_directory%
pause

File name is coming in SQL query output from unix

I have written a simple sh file to retrieve data from Oracle SQL but getting error. Following is my code:
. $HOME/.profile
function assignVariables
{
ID="finapp"
PASS="finapp"
MAIL_BODY_PATH="/rbluat/BACKEND/Finacle/FC10.2.9/app/CDCI_LOGS/"
}
echo $ID
echo $PASS
function getDatatrans
{
TRANID=`sqlplus -s $ID/$PASS#rbluat <<EOF
SELECT DISTINCT TRAN_ID,DTH_INIT_SOL_ID,TRAN_DATE,DEL_FLG FROM TBAADM.DTD WHERE PSTD_FLG='N' AND ENTRY_USER_ID='FIVUSR' and del_flg='N' and tran_date=(select db_stat_date from tbaadm.gct)AND REF_NUM IN (SELECT PYMT_REF_NUM FROM TBAADM.PORD WHERE STATUS IN ('A','H'));
exit;
EOF`
}
assignVariables
getDatatrans
echo $TRANID
I am getting output as :
[YOU HAVE NEW MAIL]
SELECT DISTINCT TRAN_ID,DTH_INIT_SOL_ID,TRAN_DATE,DEL_FLG FROM TBAADM.DTD WHERE PSTD_FLG='N' AND ENTRY_USER_ID='FIVUSR' and del_flg='N' and tran_date=(select db_stat_date from tbaadm.gct)AND REF_NUM IN (SELECT PYMT_REF_NUM FROM TBAADM.PORD WHERE STATUS IN ('A','H')) few.sh test.sh ERROR at line 1: ORA-00942: table or view does not exist
`
Here few.sh and test.sh are the file names present in the current working directory. few.sh is the file where I have written this code. I have no idea how these names are coming. I am working in KSH. I tried googling about it but found no clue.
The output of sqlplus in evaluated in the command
echo $TRANID
When TRANID has a * in it, ksh will show the files it can find.
You should use quotes to avoid evaluation:
echo "$TRANID"
When you are editing you code, you might as well add {} (not needed here, good habit):
echo "${TRANID}"
Likewise:
echo "${ID}"
echo "${PASS}"
...
-s "${ID}/${PASS}#rbluat"

dynamically fetching dynamic variable's value from properties file

Below unix commands works:
export myTempVar=myTempVar1
export myTempVar1=myTempVar2
eval echo '$'$myTempVar
This correctly prints myTempVar2.
However, what if myTempVar1=myTempVar2 is present in a properties file instead of directly in the script.
So my script will have
. $MYDIR/myProperties.properties
myTempVar=myTempVar1
myTempVar3=eval echo '$'$myTempVar
Above lines are not working and the value of myTempVar3 is not coming as myTempVar2.
myProperties.properties is having below line:
myTempVar1=myTempVar2
Using indirection is far safer than eval:
#!/bin/bash
. $MYDIR/myProperties.properties # myTempVar1=myTempVar2
myTempVar=myTempVar1
myTempVar3=${!myTempVar}
echo $myTempVar3
Gives:
myTempVar2
and you don't need the echo in eval:
eval myTempVar3='$'$myTempVar

Adding php variable to <a href name part

Here is my code there is plenty more but these work independently
echo $row['Queue'];
echo "Modify";
what I want to do is this
echo "$row['Queue']";
this doesn't work and gives a syntax error. any tips on how to get this to work?
thanks!
This would be:
echo "" . $row['Queue'] . "";
echo "".$row['Queue']."";