Google js file not loading on runtime - php

I am trying to include these files from google API, but when I run my file I can't > find them including in the head of the file
<link href='http://fonts.googleapis.com
/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic'
rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0
/jquery.min.js"></script>

Open the link
http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic
in the browser
Do a 'save as' on the resulting webpage that contains the media css.
Assuming you have saved it as 'file.css'
<link href='file.css' rel='stylesheet' type='text/css'>
Do the same for the 'jquery.min.js' file and change you script tag as follows:Assuming you have saved it as 'file.js'
<script type="text/javascript" src="file.js"></script>
This way you have both the files locally and don't have to depend on the internet to download them every time.

Related

Why all my scripts are being loaded together and they return not found after a few days?

I have php scripts in my website and at the top of the page css and js are being loaded like below
<link href="css/pageLayout.css?version=4" rel="stylesheet" type="text/css" media="screen,print">
<link href="css/style.css?version=4" rel="stylesheet" type="text/css" media="screen,print">
<script src="validation.js?version=4" type="text/javascript"></script>
<script src="numcheck.js?version=4" type="text/javascript"></script>
But when I view source of my page the links are like below
<link href="css/pageLayout.css,qv==4+style.css,qv==4.pagespeed.cc.E_3tcdStoh.css" rel="stylesheet" type="text/css" media="screen,print">
<script src="Script/validation.js,qv==4+numcheck.js,qv==4.pagespeed.jc.-0oIAICDu_.js"></script>
It seems someone/something is putting all my files together, must be some component in either the server or the browser, but I can't seem to find it.
At first, it works without any problem, so I didn't notice. But after a few days these put together files are not found anymore and returns 401 not found, and none of the css and js works anymore.
It works again if I change the link of the file by changing the version number version, but returns after a few days. Any idea what might be the reason?

Css link to php file

enter image description hereI added a css link to my php file, but it won't show the changes.
My css file is named register.css and my php file is named register.php.
<?php
include("includes/config.php");
include("includes/classes/Account.php");
include("includes/classes/Constants.php");
$account = new Account($con);
include("includes/handlers/register-handler.php");
include("includes/handlers/login-handler.php");
function getInputValue($name) {
if(isset($_POST[$name])) {
echo $_POST[$name];
}
}
?>
<html>
<head>
<title>Welcome to Napster!</title>
<link rel="stylesheet" type="text/css" href="assets/css/register.css"/>
</head>'
My css file is in assets file which is in same file as my php file.
I am using xamp and sublime text.
it seems the issue is either browser cache or related to path..
please try
<link rel="stylesheet" type="text/css" href="assets/css/register.css?v=1.1"/>
if register.php is not in root folder then try..
<link rel="stylesheet" type="text/css" href="../assets/css/register.css?v=1.1"/>
here ?v=1.1 is added to load updated css. whenever you make changes in css file, simply chage v=1.1 with another number like v=1.2 etc... to avoid clear cache in browser and load updated css...

uploading Axure exported html to wordpress

I would like to upload my Axure exported html (some javascript, css, and html files - all static content) to my wordpress site.
Now, I know I can simply connect with ftp and upload the folder to the hosted drive. But I'm not sure if that's the prefered method, what security issues are the to resolve (htaccess files??), and how to link to the mockup I made in my Axure in a frame (so it dynamically resizes).
Am I trying something that's just impossible, bad practice, ... Would I need to touch php? because my web knowledge goes as far as js/css... newbie too.
Help?
Thanks!
I don't see any security concerns, or need to touch the htaccess file.
A sample of a wireframe I've shared and embedded in Wordpress is at: http://paulsizemore.com/4234-2/
Essentially, you need to add the references to the script files in the Wordpress content editor. You will need to add the web address to the href attributes of the tags.
The Wordpress Content Editor View
<meta name="apple-mobile-web-app-capable" content="yes" />
<link href="http://r4qr5p.axshare.com/resources/css/jquery-ui-themes.css" type="text/css" rel="stylesheet">
<link href="http://r4qr5p.axshare.com/resources/css/axure_rp_page.css" type="text/css" rel="stylesheet">
<link href="http://r4qr5p.axshare.com/LogIn_files/axurerp_pagespecificstyles.css" type="text/css" rel="stylesheet">
<!--[if IE 6]>
<link href="http://r4qr5p.axshare.com/LogIn_files/axurerp_pagespecificstyles_ie6.css" type="text/css" rel="stylesheet">
<![endif]-->
<script type="text/javascript">
AXSHARE_HOST_URL = 'http://share.axure.com';
AXSHARE_HOST_SECURE_URL = 'https://share.axure.com';
</script>
<script src="http://r4qr5p.axshare.com/data/sitemap.js"></script>
<script src="http://r4qr5p.axshare.com/resources/scripts/jquery-1.7.1.min.js"></script>
<script src="http://r4qr5p.axshare.com/resources/scripts/axutils.js"></script>
<script src="http://r4qr5p.axshare.com/resources/scripts/jquery-ui-1.8.10.custom.min.js"></script>
<script src="http://r4qr5p.axshare.com/resources/scripts/axurerp_beforepagescript.js"></script>
<script src="http://r4qr5p.axshare.com/resources/scripts/messagecenter.js"></script>
<script src='http://r4qr5p.axshare.com/LogIn_files/data.js'></script>
<!-- This is the iframe of the Axure Share URL -->
<iframe src="http://r4qr5p.axshare.com/" width="800"></iframe>

(12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp

Background:
I have a custom CMS website that is MYSQL driven. A php script that connects to a db to load content for the webpage.
Each page loaded connects to the db using the same script.
This includes php, js, css files as well
The script connects to the db is as follows:
$my_link=mysql_connect("localhost",$dbusername,$dbpassword);
#mysql_select_db($database) or databaserror();
One of the pages has the following inside
<link href="/administrator/files/master.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/administrator/files/cbdb-btn.css" />
<link rel="stylesheet" type="text/css" href="/administrator/files/BreadCrumb.css" />
<link rel="stylesheet" type="text/css" href="/administrator/files/prettyPhoto.css" />
<link rel="stylesheet" type="text/css" href="/administrator/files/tabs.css" />
<script src="/administrator/files/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="/administrator/files/context_menu.js"></script>
<script type="text/javascript" src="/administrator/files/jquery.spinner.js"></script>
<script type="text/javascript" src="/administrator/files/jquery.jBreadCrumb.js"></script>
<script type="text/javascript" src="/administrator/files/jquery_upload.js"></script>
<script type="text/javascript" src="/administrator/files/prettyPhoto.js"></script>
<script type="text/javascript" src="/admin/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/admin/ckeditor/adapters/jquery.js"></script>
All files starting with /administrator/files/ including the file with the above information are mysql driven.
The above file has an establish mysql db
$my_link=mysql_connect("localhost",$dbusername,$dbpassword);
then as it loads the style sheet
<link href="/administrator/files/master.css" rel="stylesheet" type="text/css" />
it connect to the db again using
$my_link=mysql_connect("localhost",$dbusername,$dbpassword);
and it repeats for all .css and .js files.
It doesn't happen on every page refresh however I get an error message 1 in 5 page loads
(12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp
Am I connecting to MySQL incorrectly?
If i do not include mysql driven style sheets or js files there are no problems, OR if i load the style sheet pages on their own, there are no problems.
Memory is set to 500mb,
When mysql driven pages are loaded individually the memory stays close to 0mb when more then 1 mysql driven page is loaded, the memory is spiked up to the maximum
Let me know if you require more information.
Thank you
As i have already told in the comment that you are tying to connect mysql database for each and every query as this may slow down the server uses more memory so connect mysql db once and send as many queries you need or you can try increasing memory limit using the code below
ini_set('memory_limit','200M');
The 20M represents that its 20 Megabytes.
Insert the above code in your php script where you want ...

using lightbox with code igniter

I'm trying to use Lightbox with my CodeIgniter application. Lightbox says to put the following in the head tag:
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
I already had a js folder and a css folder, so I put the js and css folders that came with lightbox within my js and css folder. I changed the 3 script tags and link tags to:
<script type="text/javascript" src="js/js/prototype.js"></script>
<script type="text/javascript" src="js/js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/js/lightbox.js"></script>
<link rel="stylesheet" href="css/css/lightbox.css" type="text/css" media="screen" />
(added the /js and /css)
in the view file I have
<img name="<?php echo $row->Thumb;?>" src="http://www.doublediamondllc.com/uploaded/portfolio/thumbs/<?php echo $row->Thumb;?>" alt="">
This displays the thumbnail version, and then when clicked I want it to go to the lightbox, but now it goes to a new tab with the large image.
I've used lightbox before and have always gotten it to work, I'm not really sure what the problem is now, and I tried moving the files all around to different spots but nothing worked.
Thanks in advance!
It seems like the .js isn't getting loaded properly. Try using Firebug, and see if any errors pop up. Alternatively, check the links in the source for the page, and make sure they are pointing to the lightbox js files correctly. If you are using Firefox, view source; the links to the js files should appear as clickable links; click on them and make sure the js file appears, and not a 404 or some other error. Otherwise copy and paste the link attributes to your browser and check the .js paths are correct.

Categories