I have a dynamic page , which fetch data from database . Say for eg there are 2 record which is generated depending on query . So what i want to do is when some one click the Home link on 1st record , it should go to next page and over there php code is there which will increment the counter that is how many times the page is visted
Similarly when 2nd record Home link is clicked it should go to some page and then again again counter for that page is incremented
so say eg
Home Page - 1st Record - Page : http://www.abc.com/Wakad-T4248349
Home Page - 2nd Record - Page : http://www.abc.com/Himn-T3333333
Or another way of doing this , please help
<div id="menubar">
<ul>
<li class="current_page_item">
Home
<?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?>
</li>
</ul>
</div>
<div id="menubar">
<ul>
<li class="current_page_item">
Home
<?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?>
</li>
</ul>
</div>
Why not just have a field in the database which keeps track of how many times that particular page has been fetched? Or are you looking for unique IPs?
Assuming you don't control abc.com, you'll have to make the link go to one of your own pages:
<a href="redirect.php?link=abc.com/Wakad-T4248349"> ...
and on redirect.php, increase your counter (which you'll probably want to store in a DB...) and redirect them to the page.
Related
How to add Flag icons next to logged in username in navbar?
Using Php oop MySQL database on a signup/login system. I have users_country as one of my database columns. This is put in the table as the classic two letter format, example: Netherlands is stored as NL.
After a user logs in I have my nav bar change from sign up, sign in
to usercountry & username, logout
I do that with php
Session start ()
echo $_SESSION[“usercountry”]
echo $_SESSION[“useruid”] (their username)
Now my navbar reads, example:
NLtestuser, logout
How do I go about replacing just the NL country code next to the username in the navbar to be an icon with the corresponding flag.
I would like the user to log in and the flag they selected upon signup will show instead of the flags two digit id.
I already have a flagicons folder in img folder in the root folder that contains all the flag icons with their corresponding countryid.png, example: nl.png
What is the simplest way to just change the country code to the icon flag when the user is logged in?
Thanks.
This is your code reformatted, with the code to show the flag:
<ul class="left-side">
<?php
if(isset($_SESSION["userid"])) {
?>
<li><img src="/img/<?php echo strtolower($_SESSION["usercountry"]); ?>.png" alt="flag"></li>
<li>logout</li>
<?php
} else {
?>
<li><a href='Signin.php'>Sign in</a></li>
<li><a href='signup.php'>Sign up</a></li>
<?php
}
?>
</ul>
Have a look at what the HTML source looks like if the image doesn't show up.
How do I format a link that will go to an anchor within a PHP document?
For example:
http://chambervu.com/lososos/index.php#p=10 - does not display the intended result, however if I go to http://chambervu.com/lososos/index.php then once that page is displayed if I append "#p=10" then everything displays as intended. How would I form the link to display page 10 directly?
The "pages" in my index file are setup like this:
<li class="page" data-name="5">
<div class="blah....blah"
</div>
</li>
</div>
</li>
<li class="page" data-name="6">
<div class="blah..blah"
</div>
</li>
Fragments point to an ID on the page, when you visit an HTML page with a fragment in the URL, the browser tries to find an element with a matching ID and scroll to it.
The javascript you have running on the page takes the fragment when it changes (after the page has loaded) and parses it to determine which page to show.
Linking directly to that page like you want would require some editting of the javascript at the very least.
every day, unloading a file that contains a set of url I have to change every day in css menu that I have the page. The only thing that does not change the name assigned to the url. You assigning each a name or other ID, go to the new url css menu without changing it every day?
Today
file.php
<a href='http://playlist.m3u.com/playlist1.m3u'>playlist1</a><br/>
<a href='http://playlist.m3u.com/playlist2.m3u'>playlist2</a><br/>
<a href='http://playlist.m3u.com/playlist3.m3u'>playlist3</a><br/>
Tomorrow
file.php
<a href='http://playlist.m3u.com/playlist4.m3u'>playlist1</a><br/>
<a href='http://playlist.m3u.com/playlist5.m3u'>playlist2</a><br/>
<a href='http://playlist.m3u.com/playlist6.m3u'>playlist3</a><br/>
Every day changes the url but not the playlist name
menu_index.html
<ul>
<li><a href='http://playlist.m3u.com/playlist1.m3u'>playlist1</a><br/></li>
<li><a href='http://playlist.m3u.com/playlist2.m3u'>playlist2</a></li>
<li><a href='http://playlist.m3u.com/playlist3.m3u'>playlist3</a></a></li>
</ul>
On this file, I change the link every day, but I would find a way to not edit it every day if possible.
The index is a menu in css menu dropdown, I would like to avoid having the classic white page with hyperlinks.
if i'm right understand you:
<?php $array = array('playlist1','playlist2','playlist3');?>
<ul><?php
foreach($array as $val){
?><li><a href='http://playlist.m3u.com/<?=$val?>.m3u'>playlist1</a><br/></li><?php
}
?></ul>
I have looked for a while for a solution to this, but have been unsuccessful so far. Not sure if it's me, or if there's a problem with the pagination functionality.
What I'm trying to do
When on a page within a certain channel, I want to have 'prev' and 'next' buttons to click through to the next article in the channel. These links must use the page_uri set for each page.
What I've tried
I have a channel full of pages. In the template, I have added:
{exp:channel:entries channel="project" dynamic="no" orderby="date" sort="desc" limit="1" paginate="bottom"}
<div class="container-fluid project-section pagination-bar">
<div class="container">
<div class="col-md-12">
{paginate}
{pagination_links}
<ul>
{previous_page}
<li>Previous Page</li>
{/previous_page}
{next_page}
<li>Next Page</li>
{/next_page}
</ul>
{/pagination_links}
{/paginate}
</div>
</div>
</div>
{/exp:channel:entries}
This is adding the links to the bottom of the page, but when clicking on them the URLs are just loading the same URL you're currently on, then adding /P1 to the end.
I need it to use the page_uri added in the CMS so that it clicks through properly and doesn't affect SEO on the site.
Any help appreciated on this one, thanks
Pagination isn't really the way around this. You should look into Next/Previous Entry Linking. It'll give you a full link to the previous and next entry. Just make sure to keep it outside your channel entries loop.
For example you'd want something like:
{exp:channel:prev_entry channel="project"}
View previous project
{/exp:channel:prev_entry}
{exp:channel:next_entry channel="project"}
View next project
{/exp:channel:next_entry}
Assuming your projects all live in a section called projects you'd be linking between
/projects/example-project-1
/projects/example-project-2
/projects/example-project-3
I'm working on a scrollable one-page website, in which each div represents a different section. For example, url is dynaone.com/index.php, and when I click on the menu's different buttons, it changes to /index.php#s1, #s2, #s3, and so on. In section nº 2 I added another menu that works with php GET, in a way that when you click on one of the buttons, it redirects you to index.php?id=1 and so on. Of course when I first tried it, it scrolled me back to the top of the page, 'home', as I wasn't specifying the section. But when I did, assigning "index.php?id=1#s2" to the first element in the inner menu, it redirected me to section 1. It doesn't matter which number I write after "#s", it will keep putting section nº 1 on top of the page.
I'm using SMINT's demo as a base, adjusting it to my website's needs, but I couldn't find anything related to GET method issues on the plugin's page.
I would really appreciate some help with this, as it's very annoying having to go back everytime I click to correctly view section nº 2.
This is part of my inner menu:
<div id="botonera_productos"><ul>
<li> Quemadores </li>
<li> BCAAs</li> </ul> </div>
This is my php section:
if(#$_GET['id']==1) {
?>
<figure><img src="imagenes/quemadores/1.jpg"><figcaption> ULTIMATE L-CARNITINA 500 60 TABS - <b>$330</b> </figcaption></figure>
<?php } ?>
And this is the site's main menu:
<nav class="subMenu" >
<div class="inner">
Home
Nosotros
Productos
Local
Envíos
Consultas
Facebook
</div>
</nav>
Thank you.
The question isn't very clear but basically:
The anchor is an HTML construct. So once the page is already loaded, you can use #whatever to take you to wherever on that page that the anchor has been defined; ala <a id="whatever">
The PHP arguments, like ?id=1 - a new page will be loaded depending on what you use here.
You can use anchors in conjunction with a PHP page (ie. a PHP page may have multiple anchors) but you cannot load a new page with anchors alone.
Maybe Javascript will help you achieve what you want to do. With AJAX calls and the like then there are far less restrictions on how you load data.