Codeigniter: Favicon icon is not loading, checked in all browser - codeigniter-3

Problem: Favicon Icon is not loading.
I have a folder 'Assets' in the root directory of codeigniter framework.
Assets/images/favicon.png is the path for the favicon icon image.
The image is present at the above mentioned location.
Controller code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class homeController extends CI_Controller {
public function index()
{
$this->load->helper('url');
$this->load->view('header');
}
}
View: header.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>My-site</title>
<link rel="icon" href="<?php base_url();?>assets/images/favicon.png" type="image/png">
</head>
But the image is not coming.
I tried: How to set Favicon in Codeigniter
i.e moved the favicon.png in the root folder. But still it is not working.
I tried below as well:
In controller
$this->load->helper('html');
In view:
<?php echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');?>
still it is not working.
Can anyone please help me out with this??

View source of your page in browser and check if the link tag of favicon is present . Check if favicon image path is proper and try favicon url in browser .

Related

css and js file path change when clicking other page in codeigniter

I have working stylesheet in my codeigniter homepage but if i click on another page the file path also change. that's one reason why my stylsheet not working on other page
the filepath loke like this:
localhost/foldernam/controller_name/stylesheet.css
is there any way that if i visit on other page filepath be remain?
i just want the filepath should be like this
localhost/foldernam/stylesheet.css
in my config.php
$config['base_url'] = 'http://localhost/systems/';
add base_url variabel when you include stylesheet.css, for example
<link rel="stylesheet" type="text/css" href="<?= base_url() . "stylesheet.css" ?>">
Add this code on header your html layout

How to encapsulate Play template parts in a separate module?

I have a Play application consisting of the following to modules:
angular: encapsulates all AngularJS stuff
frontend: customer faced stuff
The angular module has a webjar dependency defined in the build.sbt file. In addition, I have there the following HTML file inside the views directory:
#(webJarAssets: WebJarAssets)
<script src="#angular.controllers.routes.WebJarAssets.at(webJarAssets.locate("jquery.js"))"></script>
<script src="#angular.controllers.routes.WebJarAssets.at(webJarAssets.locate("angularjs.js"))"></script>
My controller looks like this:
package angular.controllers
import javax.inject._
import play.api.mvc._
#Singleton
class TestController #Inject() (webJarAssets: WebJarAssets) extends Controller {
def index = Action {
Ok(angular.views.html.test(webJarAssets))
}
}
So far so good, when accessing the corresponding route, everything renders fine. However, that's not how I want to use this module.
In my frontend module I have a template named main.scala.html which looks like this:
#(title: String)(content: Html)
<!DOCTYPE html>
<html lang="en">
<head>
#* Here's where we render the page title `String`. *#
<title>#title</title>
<link rel="stylesheet" media="screen" href="#routes.Assets.versioned("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="#routes.Assets.versioned("images/favicon.png")">
<script src="#routes.Assets.versioned("javascripts/hello.js")" type="text/javascript"></script>
</head>
<body>
#content
</body>
</html>
Now I want to include the angular module template, which encapsulates the script tags, after #content. In addition, I want to make this optional so that I can pass a specific argument in order to activate the script inclusion. How can I make this work?

Change the Browser title

I am using links to display PDF files. I wish to show the PDF in a new tab so I add target="_blank". This works fine. A new tab is opened but I wish to change the title of the tab.
The link redirects me to this controller code as follows:-
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
#readfile($file);
The pdf is displayed correctly but there is no view script so I have no control via the script. Is there a header("Browser title: ???") I can use?
TIA Effy
For this problem, I use this trick:
I use a simple html page with an iframe like this:
<html>
<head>
<title>Your PDF Title</title>
<link type="image/x-icon" rel="icon" href="">
</head>
<body>
<iframe src="/module/controller/action/param..." id="ifrm" name="ifrm" width="100%" height="100%">
</iframe>
</body>
</html>
The iframe contains the PDF and the page has title.
Of course, you can use javascript to have a dynamic title
The internal pdfviewer in Firefox seems to fetch the title of the document from the metadata in the pdf.
With for instance Zend_Pdf this metadata can be manipulated.
$title = 'My custom title';
$pdf = Zend_Pdf::load($filepath);
$metadata = $pdf->getMetadata();
$metadataDOM = new DOMDocument();
$metadataDOM->loadXML($metadata);
$domTitle = $metadataDOM->getElementsByTagName('title')->item(0);
$domTitle->nodeValue = $title;
$pdf->setMetadata($metadataDOM->saveXML());
//maybe old style document info:
$pdf->properties['Title'] = $title;//this didn't work for me
echo $pdf->render();
I'm no DOM manipulation expert, but this worked for me with a file created with Illustrator CS5. Freely based on the Zend Framework Documentation. You might need to do some error checking along the way.

how to render javascript source code in sapui5

I want to render some javascript snippet with sapui5. I am trying to use Text control but when I use that I cannt format javascript text to show up properly.Is there a way to do that?
You can use the HTML core control to embed html/javascript: https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ui.core.HTML.html
Or create a custom control
All other SAPUI5 controls are protected against XSS and forgery attacks so they won't accept any javascript code.
I also suggest that you use sap.ui.core.HTML to embed HTML in your sapui5 view. However to get your code formatted correctly (for example it shall be indented correctly) you can use the markdown-js library. See this example:
index.html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>Render javascript source code in sapui5</title>
<script id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.ui.commons"></script>
<script src="markdown.js"></script>
<script>
$.get("markdown.md", function(data) {
var mdView = new sap.ui.core.HTML({
content: markdown.toHTML(data)
});
mdView.placeAt("uiArea");
}, "html");
</script>
</head>
<body class="sapUiBody">
<div id="uiArea"></div>
</body>
</html>
markdown.md:
# Markdown
To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab.
for (i=0; i < 10; i++) {
if (true) {
console.log("Hello World!");
}
}
If you want to test this example in you Chrome browser, do the following:
Download markdown-browser-*.tgz from markdown-js and place the contained markdown.js together with the above index.html and markdown.md in some folder.
Start Chrome with parameter --allow-file-access-from-files and drop the index.html on the Chrome browser window.

PhoneGap not working on iOS 5 device

Hi i tried creating sample index.html with simple notification code from Docs Phonegap Notification .
I zipped the index file and uploaded it to build.phonegap.com with 2.9 version. The App is successfully installed on my iPad(iOS 5) but nothing happen when i click on Show Alert. I also tried adding phonegap 2.9.0 on my Sencha Touch 2 Application ,i build it as native and installed it on my device but the app hangs on app Loading Indicator.
Index.html code:
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
// Empty
}
// alert dialog dismissed
function alertDismissed() {
// do something
}
// Show a custom alertDismissed
//
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
}
</script>
</head>
<body>
<p>Show Alert</p>
</body>
</html>
Any help is greatly appreciated.
Update:
Got things working when i add config.xml on the zip file. And added phonegap.js script inside the body tag before uploading it to build.phonegap.
Thanks
Got things working when i add config.xml on the zip file. And added phonegap.js script inside the body tag.
Thanks