How do I dynamically create a hyperlink in asp c#? - javascript

I don't have code for this, as everything I have checked does not help me.
I am merely asking whether it's possible to do what I am trying to do.
I am creating a news article website. On the create page, on button click to create, a new aspx page is generated.
"Project/Articles/(todays date folder)/newarticle.aspx" is the generated path.
The create page is "Project/Create.aspx"
What I am trying to do is create a link to the newly generated article on the homepage.
"Projects/HomePage.aspx"
I want to know if it is possible to do this, even if I need to use Javascript/jquery for it.
I've gone through dozens upon dozens of help articles and forums to find my answer, but the best I could find is generating a link on the same page.
All of this is done with webforms.

Related

I want edit every single page in wordpress. Is possible?

Sorry if this question sounds stupid but im a noob with wordpress.
I am a javascript developer, and I want make a little game (or games) with wordpress. Opening main page there is a sliding puzzle. After complete, a button appears and clicking there you pass to another page. This is basically the same to all pages.
But I can't find were i put my javascript or HTML code. I create the pages but I can't edit them the way I want, everytime i try to do it i only can edit like word. I cant create, change or edit divs attibutes or tags. To be honest the only thing i can edit is CSS in stylesheet, but is too limited.
I have done the search, try found a solutions or ways to done it but when i look to tutorials is all diferent from what i see.
to give you an ideia I want to do a mix of this:
-> http://www.rustylake.com/room-escape-games/cube-escape-case-23.html
and this
-> https://ebonyriddle.com/
but i don't know how to edit page to page.
can you help me?
Thanks for everything
PS: I know I can do it without Wordpress, but I want use it anyway to learn more about the CMS (because of work) maintain website structure and later learn how to do my own templates or plugins.
To answer your question directly, yes it is possible (and easy, relatively speaking) to add custom code to every page / post of a Wordpress site.
More generally, you’re talking about creating a custom Wordpress theme, which you can find out more about here:
https://codex.wordpress.org/Theme_Development
and here:
https://developer.wordpress.org/themes/getting-started/ (Good suggestion from #ItsGeorge)
Regarding adding custom JavaScript to a theme, your files will need to be enqueued as per these instructions.
Outlining the steps involved in Wordpress theme development would go beyond the scope of your question, but there are plenty of resources online and answers to Wordpress specific questions on wordpress.stackexchange.com. You will need to familiarise yourself with php as well as JavaScript, to take full control of Wordpress.
I would say that developing a game feels like an odd fit... If learning Wordpress is your objective, a blog or personal website might be a better place to start, then you could move onto a game once you are familiar with the concepts involved, e.g. the loop, which plays a huge part in how Wordpress works
Good luck!
The primary focus of WordPress is to put HTML code and JS out of the user. You might manage your extra JavaScript files with your theme customization. If you want to get more control about how your pages are rendering, you should use action hooks and filters. The simplest way for you is to override each page template like this
https://developer.wordpress.org/themes/basics/template-hierarchy/#single-page
The preferable resource to ask Wordpress related questions is https://wordpress.stackexchange.com/

Open same page with different content

I'm working on bookstore website. The main page has all the books. Each has it's own button. Every book has it's button linked to the same page (buy.html), I want change content by clicking on different buttons as every book has it's own description
This is my HTML button code
<button onclick="window.open('buy.html')" class="book4">Buy</button>
I need to open buy.html but with different content according to the book
but what happens now is All buttons show the same content
Can any one help me in this issue,
Thanks.
Though your question is rather broad, I think I get your problem.
You need a way to distinguish between books without creating a new page for every book.
There are multiple ways of doing this. Personally I'd recommend using Server-Side scripts for this but you can also do this with JavaScript, you just have to put it in the link.
An example could be this:
<button onclick="window.open('buy.html?book=4')" class="book4">Buy</button>
What this does is open buy.html and specify what book you want to buy so you can create a function to pull only that description out of the database or however you want to do it.
I strongly recommend a database because as soon as you have a hundred or so books your page will get really slow and it's a waste of resources if you only display one.
The best way to get data out of a URL (as far as I know) is like so
Though, next time please post your code too, that would make it a lot easier to pinpoint the problem.
Good luck.
Edit: The JavaScript that I linked was not the best solution and rather complicated so I think a better and more easily understandable function can be found here

How to make different paragraphs show up after clicking on something

This is my first question here, I'm very new to coding so please forgive me any mistakes.
So i started learning html/css/some basic javascript recently and I'm trying to build a website just for practice. So one page on it looks like this:
https://imgur.com/ZHyeprC
And right now i have different html files for each article (linked under the site navigation: Shauna, The First One etc.), so each name of the article takes you to a different page.
What i want to do is to have multiple articles in just one html file, and make them show up/disappear when the name of the article is clicked.
I tried to figure it out somehow in jquery, but i only managed to wrap the article in a div and make it appear when the invisible div is clicked... which isn't much useful.
So is it posibble to do with simple javascript/jquery? If so, the how do i do this?
Thank you all in advance, Michal.
The most easy and practical way is to have one HTML file for each article. It makes your files more organized and easier to find. Otherwise, if your client just want to look at one article the page has to load all articles which may take longer if the client happens to have a slow internet connection.

CSS-stylable popup (modal) that doesnt load until it is opened

so I'd like to build something like That.
Now I want to put a LOT of these buttons on a page and every popup must contain a different <iframe> (embedding videos). Also I'd liek them to be CSS-stylable.
So what I cant seem to achieve is two things:
- I cant find any script (I'm extremely new to web thingys) that will open DIFFERENT popups for different buttons
- I cant find something that lets the contents of the popups remain unloaded until they are actually displayed.
Thanks for any help!
PS: I only know how to use jS, HTML and CSS so I cant use fancy stuff... First project...
-edit-
Okay, i didnt know server-side things are related to this. I can use PHP (actually I'd populate the popups per PHP) so is there a way using the specified languages plus PHP? and if not, how can I achieve the other goal I specified? I have no idea of JS, I just know how to use scripts...
hope this link will help:
http://getbootstrap.com/javascript/#modals-related-target
plz recheck your data-target="#exampleModal" in button is the id of the modal and put iframe instead of this form in this link.

PHP Javascript, Website which loads everything into a div is there a way to make the back button work

I am currently building a website but in an effort to prevent not necessary data to be loaded i decided to split but the website into serveral divs and load the content inside the div.
Because of this when i click on the back button i dont go to the previous location on the site but to where i was browsing before. Is there a way to solve this without rewriting the entire site? So for instance on my site there would be a members page that would be called upon using javascript by loading $('#content').load('members.php?id=$id');
For instance by creating a fake location...index.php#fakelocation (which contains the specific content i just loaded)
Can anyone give me a push in the right direction (or if this is impossible id like to hear it to)
I think what you're looking for is a combination of the History API and AJAX.
Lucky for you, there's a great library called PJAX that combines these technologies.
Without knowing more about how your backend works, I can't comment on additional steps to optimize the whole application, but PJAX is friendly with any number of server-side technologies.

Categories