Asked  7 Months ago    Answers:  5   Viewed   37 times

I have php file index.php

In this file to use html code I am doing:


echo '
<a class="fragment" href="">

In href I want to put value of some php variable i.e. $url How could be done?

is this correct way?

 <a class="fragment" href="<?php echo $url; ?>">



You concatenate the string by ending it and starting it again:

echo '
<a class="fragment" href="' . $url . '">

Though I personally prefer to stop the PHP tags and start them again (if I have a lot of HTML) as my IDE won't syntax highlight the HTML as it's a string:

        <a class="fragment" href="<?php echo $url; ?>">link</a>
Wednesday, March 31, 2021
answered 7 Months ago

'&B' will only set bold text for printed page headers and footers, as described in the section of the documentation entitled Setting the print header and footer of a worksheet

Formatting the content of a cell is described in the section of the documentation entitled Formatting cells, something like:


or (if your content contains actual markup) using Rich Text objects if you only want to set part of the text to bold.

$objRichText = new PHPExcel_RichText();
$objRichText->createText('This text is ');

$objBoldTextRun = $objRichText->createTextRun('bold');

but you will need to parse your markup to convert it to a Rich Text object

Saturday, May 29, 2021
answered 5 Months ago

Option 1. In your file.php:

<script type="text/javascript">
   var varName = "<?php echo '1'; ?>"; // global
<script type="text/javascript" src="myscript.js"></script>

Option 2. create a PHP file that returns the javascript content type externalphp

Saturday, May 29, 2021
answered 5 Months ago

Try like


echo "<a href='".$link_address."'>Link</a>";

Or even you can try like

echo "<a href='$link_address'>Link</a>";

Or you can use PHP in HTML like


<a href="<?php echo $link_address;?>"> Link </a>
Thursday, June 17, 2021
answered 4 Months ago

Based on your screenshot of Settings (Preferences on Mac) | Editor | Language Injections.

Please delete 3rd language injection rule from the bottom (the one for "div" -- that has "IDE" in Scope column).

That rule injects HTML into div tag which tells IDE to treat all other code (even PHP) inside such tag as HTML/plain text.

Thursday, August 5, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :