I added CKEditor to my yii webApp and now i have problem with filebrowserBrowseUrl attribute,
What should i put instead of 4db59eda folder? Or how can i get assets files and folders url?
Thanks.
<script type="text/javascript">
CKEDITOR.replace( 'Projects_content',
{
filebrowserBrowseUrl :'http://localhost/altin/assets/4db59eda/filemanager/browser/default/browser.html?Connector=http://localhost/altin/assets/4db59eda/filemanager/connectors/php/connector.php',
At my project I've included the files in a folder called "js" at app root. It's at the same level of protected, css and etc.
You can add your scripts to your page like the following example:
$baseUrl = Yii::app()->baseUrl;
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($baseUrl.'/js/yourscript.js');
The best way to use URL's at the Yii is with Yii::app()->baseUrl.
Related
I'm using Nuxt 2.15.8 to generate static pages (migrating to Nuxt 3 is also an option for me if it solves the problem).
It works great when deployed in the root folder of the server but I need it to be served in a subdirectory, like:
https://my.domain.com/folder/subfolder
The problem is that the compiled HTML includes nuxt related assets like:
/_nuxt/123456789.js
which translates to:
https://my.domain.com/_nuxt/123456789.js which obviously fails as the file is in a subfolder, not in the root.
I tried using publicPath config and absolute paths but it is not an option for me as I have several environments with different URLs.
I need to generate static HTML files with relative paths in order to make sure my site works as expected in all the environments, agnostically from the server URL.
I was able to achieve it using Vite + Vue 3 but migrating to a new implementation is not an option, I need to achieve it using the current Nuxt implementation.
I tried using nuxt-vite https://vite.nuxtjs.org/ but was not able to achieve relative paths, I still get
/_nuxt/123456789.js
instead of
./_nuxt/123456789.js
../_nuxt/123456789.js
../../_nuxt/123456789.js
, etc
It seems like it's not supported in plain nuxt 2 but if you use nuxt-vite you can set vite.base to '' or './' in nuxt.config to make the paths relative.
Try this out:
export default defineNuxtConfig({
app: {
baseURL: '/mydir',
buildAssetsDir: '/mydir/_nuxt/',
},
Or just edit index.html manually...
My folder structure of Angular 10 project is given below
-Backend
-e2e
-node_modules
-src
I want to access backend/uploads/profilepic.jpg in the angular's index.html page. Simply, i just want to load an image file in the front end which is uploaded in the backend folders.
A static resource, like an image, is either bundled inside the angular webapp, by adding it to the assets folder (e.g. 'src\assets\images') and have that folder referenced inside angular.json:
"assets": [
"src/assets"
],
Or, make the backend serve that image and simply access it from the frontend like this:
<img alt="xyz" src="https://yourdomain/img_test.png">
If both the backend and frontend are hosted on the same domain, you can use relative path for the URL, i.e https://yourdomain can be omitted.
Finally, I found the solution. In order to access the files of the 'uploads' folder which is located in the backend folder. I have to make that folder static. for that in my server.js file, I have added below code
app.use('*/uploads',express.static('uploads'));
after that, I could load my image file from that uploads folder by calling
http://localhost:8090/uploads/image.jpg
I'm using nuxt generate --spa to build out my files into my dist folder. It is creating the actual .html files like products/product.html however it is still chunking the files in javascript script tags.
<script type="text/javascript" src="/_nuxt/890d3a2acad1dc557c61.js"></script>
I also have my app set as 'spa' mode in nuxt.config.js
export default {
mode: 'spa',
}
How can I set nuxt to generate the required html files and to acutally generate static .html code in the source code when you view the website in the browser?
I need to copy the index.html in public to a specific folder defined in public path, but this is not working as I expect.
I also don't want the cli to include header and scripts references in the html file.
My index html output should contains only: <div id='app'></div> plus some specific html tags required by our CMS system.
For that I use:
chainWebpack: config => {
// disable splitting of JS files for dist folder
config.optimization.delete('splitChunks')
config.plugins
.delete('html')
.delete('prefetch')
.delete('preload')
}
But my index.html is not being copied to my output path.
If I remove .delete('html'), index.html will copy normally, but with headers and script references.
I had the same with Vue Cli 3 and this used to work. What am I missing?
Im just trying Yii2. Now I have created a yii2 basic appication. Next what I want to do is change the theme. I have an HTML file I want to change this appications theme as like that HTML. I have gone through yii2 theming But Its not what i want I want to add all css,js,images,font of that HTML to my project. How can I do this in yii2 Plz somebody help me.
Hi you have to do following things for theming in yii2 as simple as yii1 :-
first of all open web.php into config directory of yii2 application,
then in component array pass view array like:
'view' => [
'theme' => [
'pathMap' => [
'#app/views' => [
'#webroot/themes/demo/views',
]
],
],
] // here demo is your folder name
now create the folder name as "themes" into web directory.
In this themes folder copy your html folder like(demo) which contains all css, js etc. files. in this folder create views folder as yii which contains main.php and others layouts if needed.
override index.php in views by your corresponding index file
by appropriate changes into paths of files. create corresponding views and
actions for your html files.
in yii2 we can define our css and js into Appasset.php .
Hi you need to do a few things to start off.
Copy the new HTML template Css, JS, Plugins and Images into your project directory eg testdrive/assets/
We need to link the CS and Js files to the project. Go to testdrive/protected/views/layouts/ directory and create a new file eg main.php add the respective css and js links to the respective files as you would on a html file in the head section.
<head>
<link href="<?php echo Yii::app()->request->baseUrl; ?>/assets/css/style.css" rel="stylesheet">
<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>
<body><? php echo $content ?></body>
3.Once the layout is ready we need to initialise yii to use the layout we have created. Proceed to the Controller eg SiteController.php
public function actionlogin{
$this->layout = 'main';
}
Now you're set to get your hands dirty.