how to include css and js in default.ctp in cakephp - cakephp-1.2

echo $this->Html->meta('icon');
echo $this->Html->css('cake.generic');
echo $this->Html->css('style_variation');
echo $this->Html->css('style');
echo $this->Html->css('suggest');
echo $this->Html->css('jquery.lightbox-0.5');
echo $javascript->link('jquery.js');
echo $javascript->link('jquery.lightbox-0.5.js');
echo $javascript->link('suggest.js');
i am using this code but this is not working.

Include css with
echo $this->Html->css('example');
and javascript with
echo $this->Html->script('example');
Do not write the .js extension when including javascript.

Related

Batch file - Multiple FTP upload with wildcard match

I need to upload via FTP some files (not all) from a folder to a remote server.
I coded the following which performs the wildcard match, but I think I am missing something to FTP the resulting files.
Remark: the problem is not to upload the folder (which is relatively simple), but to exclude some entries from the given folder and upload all other files.
I was successful in excluding those files and keep the rest, but I can't find the way to upload the latter.
In particular, mput cmd seems to not work with the input filename. Why ?
I want to focus on this question: how can I feed the FTP cmds to upload each resulting file from the above filtering ?
echo off
setlocal enabledelayedexpansion
FOR /R localfolder %%F IN (*.*) DO (
set fname=%%~nF
set ext=%%~xF
set filename=!fname!!ext!
set subfname=!fname:~0,4!
IF NOT "!subfname!" == "idat" (
echo ftp
echo open ftp.something.it
echo ftpuser
echo ftppass
echo lcd localfolder
echo cd remotefolder
echo binary
echo mput !filename!
echo disconnect
echo bye
)
)
pause
This is the solution, I was nearly close to it: just fill-in an external batch .bat file with ftp commands and then call this file at the end of each loop. Delete it and start again with the next entry on the list.
p.s.: for any further usage, beware of trimming any blank spaces before >> operator, as shown below.
#echo off
setlocal enabledelayedexpansion
FOR /R localfolder %%F IN (*.*) DO (
set fname=%%~nF
set ext=%%~xF
set filename=!fname!!ext!
set subfname=!fname:~0,4!
IF NOT "!subfname!" == "idat" (
echo open ftp.something.it>> ftp.cmds.bat
echo username>> ftp.cmds.bat
echo password>> ftp.cmds.bat
echo lcd localfolder>> ftp.cmds.bat
echo cd remotefolder>> ftp.cmds.bat
echo binary>> ftp.cmds.bat
echo mput !filename!>> ftp.cmds.bat
echo disconnect>> ftp.cmds.bat
echo bye>> ftp.cmds.bat
ftp -i -s:ftp.cmds.bat
del ftp.cmds.bat
)
)
Next script could help. Read List of FTP commands for the Microsoft command-line FTP client
#ECHO OFF
SETLOCAL EnableExtensions EnableDelayedExpansion
set "localfolder=D:\test\31441809\root" change
set "lcd-folder=%localfolder%"
set "excludeFile=nico" change to `idat`
set "ftpscript=%temp%\35574454ftp.dat" change
(
echo open ftp.something.it
echo user ftpuser
echo ftppass
echo binary
echo cd remotefolder
echo lcd %lcd-folder%
FOR /R %localfolder% %%F IN (*.*) DO (
set "fname=%%~nF"
set "ext=%%~xF"
set "filename=!fname!!ext!"
set "subfname=!fname:~0,4!"
IF /I NOT "!subfname!"=="%excludeFile%" (
if /I not "!lcd-folder!\"=="%%~dpF" (
rem change local directory only if necessary
set "lcd-folder=%%~dpF"
set "lcd-folder=!lcd-folder:~0,-1!" remove trailing backslash
echo lcd !lcd-folder!
)
echo put !filename!
)
)
echo disconnect
echo bye
)>"%ftpscript%"
type "%ftpscript%"
pause
ftp -i -n -s:"%ftpscript%"
Sample output:
d:\bat> D:\bat\SO\35574454.bat
open ftp.something.it
user ftpuser
ftppass
binary
cd remotefolder
lcd D:\test\31441809\root
put JohnDoe.txt
lcd D:\test\31441809\root\Ian-ionescu
put Ian-ionescuY.txt
lcd D:\test\31441809\root\John-doe
put John-doe.txt
put John-doeA.txt
lcd D:\test\31441809\root\Nicola-sheperd
put SheperdNicola.txt
lcd D:\test\31441809\root\Sara-smith
put Sara-smith.txt
put Sara-smithZ.txt
disconnect
bye
Press any key to continue . . .
ftp> open ftp.something.it
Connected to www.something.it.
220 FTP Server ready.
ftp> user ftpuser
331 Password required for ftpuser.
etc.etc.

Batch application selector can't open a program within the same folder

I am making a batch Application to open other Applications and Websites, I ran into a problem when making it, the application does not open unless it is within the same folder as the batch file, however upon later inspection it seems this is an incompatibility with one of the programs within it.
CD "%userprofile%\Desktop\MultiBatch\Place applications here"
start Glyph.exe
This code works, only if it is within the same folder.
if %selector% == 7 start GlyphClient.exe
How do I launch it from an external folder?
Here is the full code.
#echo off
#title Multi Tool
color 0c
:title
echo ---------------------------------------------------------------
echo -------------------MultiTool by michaelukz---------------------
echo ---------------------------------------------------------------
pause
:select1
echo ---------------------------------------------------------------
echo ------------------------Selection tool-------------------------
echo ---------------------------------------------------------------
echo [1] Website selection
echo [2] Application selection
echo [3] Calculator
echo [4] Clock [Updates every minute]
echo [E] Exit
CHOICE /C:1234E
goto action%errorlevel%
:action1
echo Website selection chosen
goto websel
:websel
echo ---------------------------------------------------------------
echo ----------------------Choose your Website----------------------
echo ---------------------------------------------------------------
echo [1] Google.com
echo [2] Minecraft.net
echo [3] Kryptocraft.net
echo [4] Amazon.co.uk
echo [5] Virmach.com Client area
echo [6] xpaw.ru
echo [7] twitter.com
echo [8] Youtube
echo [9] Exit prompt
CHOICE /C:123456789
goto web%errorlevel%
cls
:web1
echo Starting Google.com
start www.google.com
goto title
:web2
echo Starting Minecraft.net
start www.minecraft.net
goto title
:web3
echo Starting kryptocraft.net
start www.kryptocraft.net
goto title
:web4
echo Starting Amazon.co.uk
start www.amazon.co.uk
goto title
:web5
echo Starting Virmach Client panel
start www.virmach.com/manage/clientarea.php
goto title
:web6
echo Starting xpaw.ru
start www.xpaw.ru/mcstatus
goto title
:web7
echo Starting Twitter.com
start www.twitter.com
goto title
:web8
echo Starting Youtube.com
start www.youtube.com
goto title
:web9
echo Going to Exit prompt
goto extprompt
:action2
echo Application selection chosen
goto appsel
:appsel
echo ---------------------------------------------------------------
echo --------------------Choose your application--------------------
echo ---------------------------------------------------------------
echo [1] Glyph
echo [2] Photoshop
echo [3] Nero video 2015
echo [4] Mozilla firefox
echo [5] Task manager
echo [6] Notepad++
echo [7] Minecraft
echo [8] FTB Launcher
echo [9] ATLauncher
echo [Q] Exit Prompt
CHOICE /C:123456789Q
goto app%errorlevel%
cls
:app1
echo Launching Glyph
PUSHD "%userprofile%\Desktop\MultiBatch\Place applications here"
START GlyphClient.exe
POPD
goto title
You can change your cd command to cd /d ... as in the first form the current drive is not changed and if the program and batch file are in different drives the program will not be found.
Or if you know the full path to the application, you can use
start "" "x:\some\where\something.exe"
The more normal way to start programs is to specify full paths. In fact that is the only SECURE way.
So to start notepad (and start is only needed because it's in a bat file - omit start if typing - why? type start /?)
start c:\windows\system32\notepad.exe
or if using paths with spaces (have to specify window title if using quotes in command line)
start "My Window Title" "C:\Program Files\Movie Maker\DVDMaker.exe"
There is no need to change directories in Windows to run programs. It is designed that way.
Your question is not very clear on what's not working (or possibly you didn't provide enough code).
However, the code below might solve your problem:
PUSHD "%userprofile%\Desktop\MultiBatch\Place applications here"
START Glyph.exe
POPD

Javascript file loads twice

In my view, when I call inline execution <?php echo $this->Html->script('forms/contact');?> it executes okay, but when I want the script to be loaded within the head tags it generates the code twice.
In my view:
<?php $this->Html->script('forms/contact', array('inline' => false));?>
Output:
<script type="text/javascript" src="/animalmedica/js/forms/contact.js"></script>
<script type="text/javascript" src="/animalmedica/js/forms/contact.js"></script>
Any ideas why?
I can't answer your question as to why, but I had exactly the same issue. After some trial and error I came up with this solution:
In my default layout I was using both the fetch script method and scripts for layout. I only needed one
echo $this->Html->charset();
echo $this->Html->meta('icon');
echo $this->Html->css('cake.generic');
echo $this->Html->css('grid_layout');
echo $this->Html->css('style');
echo $this->Html->css('jquery-ui-1.10.3.custom');
echo $this->Html->script('countdown');
echo $this->Html->script('page');
echo $this->fetch('meta');
echo $this->fetch('css');
echo $this->fetch('script');
echo $this->Js->writeBuffer(array('cache'=>FALSE));
//echo $scripts_for_layout;
scripts for layout is now deprecated:
http://book.cakephp.org/2.0/en/views.html#using-blocks-for-script-and-css-files

How do I echo %myvariable% into a txt file from batch without giving an permanent value

I am making something that writes a program into text file and converts into a batch script.
I need to print "if %startmenu%==1 Goto Tutorial" into the text file but I get this:
If Echo is off==1 Goto Tutorial
And I don't want to set the variable to be permanent because it is a user menu.
Echo Echo [1] Tutorial >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Echo [2] Upload >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Echo [3] Download >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Echo [4] Exit >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo Set /P StartMenu >> C:\"Offline Server"\"Local Data Base"\Config\RawServer.cmd
Echo If %StartMenu%==1 Goto Tutorial
The last line is the problem.
double the percent-signs:
Echo If %%StartMenu%%==1 Goto Tutorial >> file

Problems when writing a batch file to repeat a paragraph containing %PATH%

I have written the following batch file that will write 100 paragraphs into a .bat file with incremental number changes to the file names referred.
for /l %%N in (1 5 500) do (
echo cd /D "C:\batch"
echo set PATH=C:\batch; &PATH%
echo echo Simulation 'g=0.00%%N.pre' started...
echo call %SOLVERQSP%-fp 1 -nt 3 ^
"C:\batch\0.00%%N.pre" > "C:\batch\g=0.00%%N.out"
echo echo Simulation 'g=0.00%%N' finished...
echo echo.
The problem is that the batch file is not created when the %PATH% and %SOLVERQSP% commands are present. If i remove these the script runs fine. Any suggestions of where I am going wrong or how I can avoid this
You should use some quotes and avoid the caret in your case
for /l %%N in (1 5 500) do (
echo cd /D "C:\batch"
echo set "PATH=C:\batch; %PATH%"
echo echo Simulation 'g=0.00%%N.pre' started...
echo call %%SOLVERQSP%%-fp 1 -nt 3 "C:\batch\0.00%%N.pre" > "C:\batch\g=0.00%%N.out"
echo echo Simulation 'g=0.00%%N' finished...
echo echo.
)
Just escape the % by doubling them:
echo set PATH=C:\batch;%%PATH%%

Resources